MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / db_setlocal

Function db_setlocal

3rd/lua-5.4.3/src/ldblib.c:234–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

232
233
234static 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/*

Callers

nothing calls this directly

Calls 10

getthreadFunction · 0.85
luaL_checkintegerFunction · 0.85
lua_getstackFunction · 0.85
luaL_argerrorFunction · 0.85
luaL_checkanyFunction · 0.85
lua_settopFunction · 0.85
checkstackFunction · 0.85
lua_xmoveFunction · 0.85
lua_setlocalFunction · 0.85
lua_pushstringFunction · 0.85

Tested by

no test coverage detected