getlocal

getlocal (LEVEL, LOCAL)

Returns the name and the value of the local variable with index LOCAL of the function at level level of the stack. Similar to lua_getlocal. Returns nil if LOCAL is out of range, and raises an error when called with a LEVEL that is out of range.