Difference between revisions of "Require"
From GiderosMobile
(added see also) |
|||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
− | |||
'''Available since:''' Gideros 2011.6<br/> | '''Available since:''' Gideros 2011.6<br/> | ||
− | '''Class:''' [[ | + | '''Class:''' [[(global)]]<br/> |
=== Description === | === Description === | ||
− | Loads and runs | + | Loads and runs libraries. |
<source lang="lua"> | <source lang="lua"> | ||
require(packagename) | require(packagename) | ||
</source> | </source> | ||
+ | |||
+ | 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) library to load | + | '''packagename''': (string) library to load<br/> |
=== See also === | === See also === |
Revision as of 22:24, 13 May 2022
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