lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> Here is a helper function that creates an empty table where you can supply
> the parameters you want to create the table with:
> function newtable(arraysize, hashsize)
>     return loadstring("return {" .. ("nil,"):rep(arraysize) ..
> ("[0]=nil,"):rep(hashsize) .. "}")()
> end

I think the OP wants a C binding to lua_createtable, such this:

static int luaB_createtable (lua_State *L) {
  lua_createtable(L,luaL_optstring(L,1,0),L_optstring(L,2,0));
  return 1;
}