Difference between revisions of "Debug.getlocal"

From GiderosMobile
Line 2: Line 2:
 
'''Available since:''' Gideros 2011.6<br/>
 
'''Available since:''' Gideros 2011.6<br/>
 
=== Description ===
 
=== Description ===
This function returns the name and the value of the local variable with index local of the function at level level of the stack. (The first parameter or local variable has index 1, and so on, until the last active local variable.) 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 debug.getinfo to check whether the level is valid.)  
+
<translate>This function returns the name and the value of the local variable with index local of the function at level level of the stack. (The first parameter or local variable has index 1, and so on, until the last active local variable.) 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 debug.getinfo to check whether the level is valid.)  
  
  
  Variable names starting with '(' (open parentheses) represent internal variables (loop control variables, temporaries, and C function locals).
+
  Variable names starting with '(' (open parentheses) represent internal variables (loop control variables, temporaries, and C function locals).</translate>
 
<source lang="lua">
 
<source lang="lua">
 
(string), (varies) = debug.getlocal(level,local)
 
(string), (varies) = debug.getlocal(level,local)
 
</source>
 
</source>
 
=== Parameters ===
 
=== Parameters ===
'''level''': (number) level of the scope/stack <br/>
+
'''level''': (number) <translate>level of the scope/stack</translate> <br/>
'''local''': (number) index of the function <br/>
+
'''local''': (number) <translate>index of the function</translate> <br/>
 
=== Return values ===
 
=== Return values ===
'''Returns''' (string) name of the variable<br/>
+
'''Returns''' (string) <translate>name of the variable</translate><br/>
'''Returns''' (varies) value of the variable<br/>
+
'''Returns''' (varies) <translate>value of the variable</translate><br/>

Revision as of 13:32, 23 August 2018

Available since: Gideros 2011.6

Description

This function returns the name and the value of the local variable with index local of the function at level level of the stack. (The first parameter or local variable has index 1, and so on, until the last active local variable.) 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 debug.getinfo to check whether the level is valid.)


Variable names starting with '(' (open parentheses) represent internal variables (loop control variables, temporaries, and C function locals).
(string), (varies) = debug.getlocal(level,local)

Parameters

level: (number) level of the scope/stack
local: (number) index of the function

Return values

Returns (string) name of the variable
Returns (varies) value of the variable