4 static int Lcreate_table(lua_State
*L
) {
5 lua_createtable(L
, luaL_checkinteger(L
, 1), luaL_checkinteger(L
, 2));
9 static int Lpack(lua_State
*L
) {
10 unsigned int n_args
= lua_gettop(L
);
11 lua_createtable(L
, n_args
, 1);
14 for(int arg
= n_args
; arg
>= 1; arg
--) {
15 lua_rawseti(L
, 1, arg
);
18 lua_pushinteger(L
, n_args
);
19 lua_setfield(L
, -2, "n");
23 int luaopen_util_table(lua_State
*L
) {
24 #if (LUA_VERSION_NUM > 501)
27 lua_createtable(L
, 0, 2);
28 lua_pushcfunction(L
, Lcreate_table
);
29 lua_setfield(L
, -2, "create");
30 lua_pushcfunction(L
, Lpack
);
31 lua_setfield(L
, -2, "pack");