| 192 | */ |
| 193 | |
| 194 | static 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 | |
| 207 | static int unpack (lua_State *L) { |
nothing calls this directly
no test coverage detected