Difference between revisions of "Debug.setlocal"

From GiderosMobile
m (Text replacement - "<source" to "<syntaxhighlight")
Line 5: Line 5:
 
=== <translate>Description</translate> ===
 
=== <translate>Description</translate> ===
 
<translate>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.</translate>
 
<translate>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.</translate>
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
(string) = debug.setlocal(level,local,value)
 
(string) = debug.setlocal(level,local,value)
 
</source>
 
</source>

Revision as of 15:26, 13 July 2023


Available since: Gideros 2011.6
Class: debug

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. <syntaxhighlight lang="lua"> (string) = debug.setlocal(level,local,value) </source>

Parameters

level: (number) level of the stack
local: (number) index of the variable
value: (varies) value of the variable to set

Return values

Returns (string) name of the variable or nil