The following functions allow the manipulation of the
local variables of a given activation record.
They only work if the function has been pre-compiled with debug
information (see Section 4.8).
lua_Object lua_getlocal (lua_Function func, int local_number, char **name);
int lua_setlocal (lua_Function func, int local_number);
The first one returns the value of a local variable,
and sets name
to point to the variable name.
is an index for local variables.
The first parameter has index 1, and so on, until the
last active local variable.
When called with a local_number
greater than the
number of active local variables,
or if the activation record has no debug information,
The function lua_setlocal sets the local variable local_number to the value previously pushed on the stack (see Section 5.2). If the function succeeds it returns 1. If local_number is greater than the number of active local variables, or if the activation record has no debug information, this function fails and returns 0.