Difference between revisions of "Debug.setlocal"

From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2011.6<br/> === Description === This function assigns the value value to the local variable with index local of the function at level...")
 
Line 4: Line 4:
 
This function assigns the value value to the local variable with index local of the function at level level of the stack. The function returns nil if there is no local variable with the given index, and raises an error when called with a level out of range. (You can call getinfo to check whether the level is valid.) Otherwise, it returns the name of the local variable.
 
This function assigns the value value to the local variable with index local of the function at level level of the stack. The function returns nil if there is no local variable with the given index, and raises an error when called with a level out of range. (You can call getinfo to check whether the level is valid.) Otherwise, it returns the name of the local variable.
 
<source lang="lua">
 
<source lang="lua">
(string), = debug.setlocal(levellocalvalue,)
+
(string) = debug.setlocal(level,local,value)
 
</source>
 
</source>
'''level:''' (number) level of the stack ''''''<br/>
+
'''level''': (number) level of the stack ''''''<br/>
'''local:''' (number) index of the variable ''''''<br/>
+
'''local''': (number) index of the variable ''''''<br/>
'''value:''' (varies) value of the variable to set ''''''<br/>
+
'''value''': (varies) value of the variable to set ''''''<br/>
 
'''Returns''' (string) name of the variable or nil<br/>
 
'''Returns''' (string) name of the variable or nil<br/>

Revision as of 10:19, 23 August 2018

Available since: Gideros 2011.6

Description

This function assigns the value value to the local variable with index local of the function at level level of the stack. The function returns nil if there is no local variable with the given index, and raises an error when called with a level out of range. (You can call getinfo to check whether the level is valid.) Otherwise, it returns the name of the local variable.

(string) = debug.setlocal(level,local,value)

'level: (number) level of the stack '
'local: (number) index of the variable '
'value: (varies) value of the variable to set '
Returns (string) name of the variable or nil