Returns the name and value of the local variable with the index 'local' of the function at 'level' on the stack.
See also debug.setlocal .
function f (a, b)
local c = 11
local i = 1
repeat
name, val = debug.getlocal (1, i)
if name then
print ("index", i, name, "=", val)
i = i + 1
end -- if
until not name
end -- function f
f (22, 33)
-->
index 1 a = 22
index 2 b = 33
index 3 c = 11
index 4 i = 4