[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Table Constructor
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Fri, 13 Mar 2009 14:36:55 -0300
> 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;
}