| 232 | |
| 233 | |
| 234 | static int db_setlocal (lua_State *L) { |
| 235 | int arg; |
| 236 | const char *name; |
| 237 | lua_State *L1 = getthread(L, &arg); |
| 238 | lua_Debug ar; |
| 239 | int level = (int)luaL_checkinteger(L, arg + 1); |
| 240 | int nvar = (int)luaL_checkinteger(L, arg + 2); |
| 241 | if (l_unlikely(!lua_getstack(L1, level, &ar))) /* out of range? */ |
| 242 | return luaL_argerror(L, arg+1, "level out of range"); |
| 243 | luaL_checkany(L, arg+3); |
| 244 | lua_settop(L, arg+3); |
| 245 | checkstack(L, L1, 1); |
| 246 | lua_xmove(L, L1, 1); |
| 247 | name = lua_setlocal(L1, &ar, nvar); |
| 248 | if (name == NULL) |
| 249 | lua_pop(L1, 1); /* pop value (if not popped by 'lua_setlocal') */ |
| 250 | lua_pushstring(L, name); |
| 251 | return 1; |
| 252 | } |
| 253 | |
| 254 | |
| 255 | /* |
nothing calls this directly
no test coverage detected