Difference between revisions of "Loadstring"
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>Gets the chunk from the given string. | + | <translate>Gets the chunk from the given string. To load and run a given string, use the idiom |
− | To load and run a given string, use the idiom | ||
''assert(loadstring(s))()'' | ''assert(loadstring(s))()'' | ||
Line 13: | Line 13: | ||
(function) = loadstring(string,chunkname) | (function) = loadstring(string,chunkname) | ||
</source> | </source> | ||
+ | |||
=== <translate>Parameters</translate> === | === <translate>Parameters</translate> === | ||
'''string''': (string) <translate>string to load and compile</translate> <br/> | '''string''': (string) <translate>string to load and compile</translate> <br/> | ||
'''chunkname''': (string) <translate>is used as the chunk name for error messages and debug information.</translate> '''optional'''<br/> | '''chunkname''': (string) <translate>is used as the chunk name for error messages and debug information.</translate> '''optional'''<br/> | ||
+ | |||
=== <translate>Return values</translate> === | === <translate>Return values</translate> === | ||
'''<translate>Returns</translate>''' (function) <translate>compiled chunk as a function; otherwise, returns nil</translate><br/> | '''<translate>Returns</translate>''' (function) <translate>compiled chunk as a function; otherwise, returns nil</translate><br/> | ||
+ | |||
+ | {{(global)}} |
Revision as of 04:11, 11 February 2020
Available since: Gideros 2011.6
Class: (global)
Description
Gets the chunk from the given string. To load and run a given string, use the idiom
assert(loadstring(s))()
Chunkname is used as the chunk name for error messages and debug information. When absent, chunkname defaults to the given string.
(function) = loadstring(string,chunkname)
Parameters
string: (string) string to load and compile
chunkname: (string) is used as the chunk name for error messages and debug information. optional
Return values
Returns (function) compiled chunk as a function; otherwise, returns nil