Difference between revisions of "Loadstring"

From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2011.6<br/> === Description === Gets the chunk from the given string. To load and run a given string, use the idiom `assert(lo...")
 
Line 9: Line 9:
 
Chunkname is used as the chunk name for error messages and debug information. When absent, chunkname defaults to the given string.
 
Chunkname is used as the chunk name for error messages and debug information. When absent, chunkname defaults to the given string.
 
<source lang="lua">
 
<source lang="lua">
(function), = loadstring(stringchunkname,)
+
(function) = loadstring(string,chunkname)
 
</source>
 
</source>
'''string:''' (string) string to load and compile ''''''<br/>
+
'''string''': (string) string to load and compile ''''''<br/>
'''chunkname:''' (string) is used as the chunk name for error messages and debug information. '''optional'''<br/>
+
'''chunkname''': (string) is used as the chunk name for error messages and debug information. '''optional'''<br/>
 
'''Returns''' (function) compiled chunk as a function; otherwise, returns nil<br/>
 
'''Returns''' (function) compiled chunk as a function; otherwise, returns nil<br/>

Revision as of 10:16, 23 August 2018

Available since: Gideros 2011.6

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)

'string: (string) string to load and compile '
chunkname: (string) is used as the chunk name for error messages and debug information. optional
Returns (function) compiled chunk as a function; otherwise, returns nil