Difference between revisions of "Require"
From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2011.6<br/> === Description === Loads and runs libraries. Roughly, `require` does the same job as `dofile`, but, `require` searches fo...") |
|||
Line 4: | Line 4: | ||
Loads and runs libraries. 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. | Loads and runs libraries. 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. | ||
<source lang="lua"> | <source lang="lua"> | ||
− | + | require(packagename) | |
</source> | </source> | ||
'''packagename:''' (string) library to load ''''''<br/> | '''packagename:''' (string) library to load ''''''<br/> |
Revision as of 10:11, 23 August 2018
Available since: Gideros 2011.6
Description
Loads and runs libraries. 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.
require(packagename)
'packagename: (string) library to load '