MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / tremove

Function tremove

src/Chain/libraries/glua/ltablib.cpp:119–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117
118
119static int tremove(lua_State *L) {
120 lua_Integer size = aux_getn(L, 1, TAB_RW);
121 lua_Integer pos = luaL_optinteger(L, 2, size);
122 if (pos != size) /* validate 'pos' if given */
123 luaL_argcheck(L, 1 <= pos && pos <= size + 1, 1, "position out of bounds");
124 lua_geti(L, 1, pos); /* result = t[pos] */
125 for (; pos < size; pos++) {
126 lua_geti(L, 1, pos + 1);
127 lua_seti(L, 1, pos); /* t[pos] = t[pos + 1] */
128 }
129 lua_pushnil(L);
130 lua_seti(L, 1, pos); /* t[pos] = nil */
131 return 1;
132}
133
134
135/*

Callers

nothing calls this directly

Calls 3

lua_getiFunction · 0.85
lua_setiFunction · 0.85
lua_pushnilFunction · 0.85

Tested by

no test coverage detected