MCPcopy Create free account
hub / github.com/BigPig0/RelayLive / tremove

Function tremove

ThirdParty/lua/lua/ltablib.c:104–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102
103
104static int tremove (lua_State *L) {
105 TabA ta;
106 lua_Integer size = aux_getn(L, 1, &ta);
107 lua_Integer pos = luaL_optinteger(L, 2, size);
108 if (pos != size) /* validate 'pos' if given */
109 luaL_argcheck(L, 1 <= pos && pos <= size + 1, 1, "position out of bounds");
110 (*ta.geti)(L, 1, pos); /* result = t[pos] */
111 for ( ; pos < size; pos++) {
112 (*ta.geti)(L, 1, pos + 1);
113 (*ta.seti)(L, 1, pos); /* t[pos] = t[pos + 1] */
114 }
115 lua_pushnil(L);
116 (*ta.seti)(L, 1, pos); /* t[pos] = nil */
117 return 1;
118}
119
120
121static int tmove (lua_State *L) {

Callers

nothing calls this directly

Calls 2

luaL_optintegerFunction · 0.85
lua_pushnilFunction · 0.85

Tested by

no test coverage detected