MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / tremove

Function tremove

third-party/lua-5.2.4/src/ltablib.c:69–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67
68
69static int tremove (lua_State *L) {
70 int size = aux_getn(L, 1);
71 int pos = luaL_optint(L, 2, size);
72 if (pos != size) /* validate 'pos' if given */
73 luaL_argcheck(L, 1 <= pos && pos <= size + 1, 1, "position out of bounds");
74 lua_rawgeti(L, 1, pos); /* result = t[pos] */
75 for ( ; pos < size; pos++) {
76 lua_rawgeti(L, 1, pos+1);
77 lua_rawseti(L, 1, pos); /* t[pos] = t[pos+1] */
78 }
79 lua_pushnil(L);
80 lua_rawseti(L, 1, pos); /* t[pos] = nil */
81 return 1;
82}
83
84
85static void addfield (lua_State *L, luaL_Buffer *b, int i) {

Callers

nothing calls this directly

Calls 3

lua_rawgetiFunction · 0.70
lua_rawsetiFunction · 0.70
lua_pushnilFunction · 0.70

Tested by

no test coverage detected