MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / tpack

Function tpack

extlibs/lua/src/ltablib.c:180–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178*/
179
180static int tpack (lua_State *L) {
181 int i;
182 int n = lua_gettop(L); /* number of elements to pack */
183 lua_createtable(L, n, 1); /* create result table */
184 lua_insert(L, 1); /* put it at index 1 */
185 for (i = n; i >= 1; i--) /* assign elements */
186 lua_seti(L, 1, i);
187 lua_pushinteger(L, n);
188 lua_setfield(L, 1, "n"); /* t.n = number of elements */
189 return 1; /* return table */
190}
191
192
193static int tunpack (lua_State *L) {

Callers

nothing calls this directly

Calls 5

lua_gettopFunction · 0.85
lua_createtableFunction · 0.85
lua_pushintegerFunction · 0.85
lua_setfieldFunction · 0.85
lua_setiFunction · 0.70

Tested by

no test coverage detected