Difference between revisions of "Require"
From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>") |
|||
(11 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
'''Available since:''' Gideros 2011.6<br/> | '''Available since:''' Gideros 2011.6<br/> | ||
+ | '''Class:''' [[(global)]]<br/> | ||
+ | |||
=== Description === | === Description === | ||
− | + | Loads and runs libraries. | |
− | + | <syntaxhighlight lang="lua"> | |
− | + | require(packagename) | |
− | + | </syntaxhighlight> | |
+ | |||
+ | Roughly, '''require''' does the same job as [[dofile]] but '''require''' searches for the file in a path. Because of that, '''require''' is the preferred function in Lua for loading libraries. | ||
+ | |||
=== Parameters === | === Parameters === | ||
− | '''packagename''': (string) | + | '''packagename''': (string) library to load<br/> |
+ | |||
+ | === See also === | ||
+ | '''[[Loading Order of Lua Files]]''' | ||
+ | |||
+ | {{(global)}} |
Latest revision as of 15:32, 13 July 2023
Available since: Gideros 2011.6
Class: (global)
Description
Loads and runs libraries.
require(packagename)
Roughly, require does the same job as dofile but require searches for the file in a path. Because of that, require is the preferred function in Lua for loading libraries.
Parameters
packagename: (string) library to load
See also