MCPcopy Create free account
hub / github.com/DFHack/dfhack / pack

Function pack

depends/lua/src/ltablib.c:194–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192*/
193
194static int pack (lua_State *L) {
195 int i;
196 int n = lua_gettop(L); /* number of elements to pack */
197 lua_createtable(L, n, 1); /* create result table */
198 lua_insert(L, 1); /* put it at index 1 */
199 for (i = n; i >= 1; i--) /* assign elements */
200 lua_seti(L, 1, i);
201 lua_pushinteger(L, n);
202 lua_setfield(L, 1, "n"); /* t.n = number of elements */
203 return 1; /* return table */
204}
205
206
207static int unpack (lua_State *L) {

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected