Difference between revisions of "Require"

From GiderosMobile
Line 3: Line 3:
 
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
 
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
 
'''<translate>Class</translate>:''' [[Special:MyLanguage/(global)|(global)]]<br/>
 
'''<translate>Class</translate>:''' [[Special:MyLanguage/(global)|(global)]]<br/>
 +
 
=== <translate>Description</translate> ===
 
=== <translate>Description</translate> ===
 
<translate>Loads and runs libraries. Roughly, [[Special:MyLanguage/require|require]] does the same job as [[Special:MyLanguage/dofile|dofile]], but, [[Special:MyLanguage/require|require]] searches for the file in a path. Because of that, [[Special:MyLanguage/require|require]] is the preferred function in Lua for loading libraries.</translate>
 
<translate>Loads and runs libraries. Roughly, [[Special:MyLanguage/require|require]] does the same job as [[Special:MyLanguage/dofile|dofile]], but, [[Special:MyLanguage/require|require]] searches for the file in a path. Because of that, [[Special:MyLanguage/require|require]] is the preferred function in Lua for loading libraries.</translate>
 
<source lang="lua">
 
<source lang="lua">
require(packagename)
+
require(packagename)
 
</source>
 
</source>
 +
 
=== <translate>Parameters</translate> ===
 
=== <translate>Parameters</translate> ===
 
'''packagename''': (string) <translate>library to load</translate> <br/>
 
'''packagename''': (string) <translate>library to load</translate> <br/>
 +
 +
{{(global)}}

Revision as of 04:28, 11 February 2020


Available since: Gideros 2011.6
Class: (global)

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)

Parameters

packagename: (string) library to load