| 110 | |
| 111 | |
| 112 | static const char *findlocal (lua_State *L, CallInfo *ci, int n) { |
| 113 | const char *name; |
| 114 | Proto *fp = getluaproto(ci); |
| 115 | if (fp && (name = luaF_getlocalname(fp, n, currentpc(L, ci))) != NULL) |
| 116 | return name; /* is a local variable in a Lua function */ |
| 117 | else { |
| 118 | StkId limit = (ci == L->ci) ? L->top : (ci+1)->func; |
| 119 | if (limit - ci->base >= n && n > 0) /* is 'n' inside 'ci' stack? */ |
| 120 | return "(*temporary)"; |
| 121 | else |
| 122 | return NULL; |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | |
| 127 | LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) { |
no test coverage detected