| 178 | */ |
| 179 | |
| 180 | static 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 | |
| 193 | static int tunpack (lua_State *L) { |
nothing calls this directly
no test coverage detected