Difference between revisions of "Debug.getlocal"
From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2011.6<br/> === Description === This function returns the name and the value of the local variable with index local of the function at...") |
m (Text replacement - "</source>" to "</syntaxhighlight>") |
||
(9 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
− | '''Available since:''' Gideros 2011.6<br/> | + | <languages /> |
− | === Description === | + | '''<translate>Available since</translate>:''' Gideros 2011.6<br/> |
− | 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>Class</translate>:''' [[Special:MyLanguage/debug|debug]]<br/> |
+ | === <translate>Description</translate> === | ||
+ | <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> |
− | < | + | <syntaxhighlight lang="lua"> |
− | (string) (varies) | + | (string), (varies) = debug.getlocal(level,local) |
− | </ | + | </syntaxhighlight> |
− | '''level | + | === <translate>Parameters</translate> === |
− | '''local | + | '''level''': (number) <translate>level of the scope/stack</translate> <br/> |
− | '''Returns''' (string) name of the variable<br/> | + | '''local''': (number) <translate>index of the function</translate> <br/> |
− | '''Returns''' (varies) value of the variable<br/> | + | === <translate>Return values</translate> === |
+ | '''<translate>Returns</translate>''' (string) <translate>name of the variable</translate><br/> | ||
+ | '''<translate>Returns</translate>''' (varies) <translate>value of the variable</translate><br/> | ||
+ | |||
+ | {{Debug}} |
Latest revision as of 14:26, 13 July 2023
Available since: Gideros 2011.6
Class: debug
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