Mercurial > prosody-hg
comparison util-src/table.c @ 7936:582bfb39337f
Backed out changeset a3a4ed0d34f4 C99 is ok
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 02 Mar 2017 00:46:32 +0100 |
| parents | b8d694646597 |
| children | 1c6a07606309 |
comparison
equal
deleted
inserted
replaced
| 7935:96fa5ef5d613 | 7936:582bfb39337f |
|---|---|
| 5 lua_createtable(L, luaL_checkinteger(L, 1), luaL_checkinteger(L, 2)); | 5 lua_createtable(L, luaL_checkinteger(L, 1), luaL_checkinteger(L, 2)); |
| 6 return 1; | 6 return 1; |
| 7 } | 7 } |
| 8 | 8 |
| 9 static int Lpack(lua_State *L) { | 9 static int Lpack(lua_State *L) { |
| 10 int arg; | |
| 11 unsigned int n_args = lua_gettop(L); | 10 unsigned int n_args = lua_gettop(L); |
| 12 lua_createtable(L, n_args, 1); | 11 lua_createtable(L, n_args, 1); |
| 13 lua_insert(L, 1); | 12 lua_insert(L, 1); |
| 14 | 13 |
| 15 for(arg = n_args; arg >= 1; arg--) { | 14 for(int arg = n_args; arg >= 1; arg--) { |
| 16 lua_rawseti(L, 1, arg); | 15 lua_rawseti(L, 1, arg); |
| 17 } | 16 } |
| 18 | 17 |
| 19 lua_pushinteger(L, n_args); | 18 lua_pushinteger(L, n_args); |
| 20 lua_setfield(L, -2, "n"); | 19 lua_setfield(L, -2, "n"); |
