[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Second argument in luaL_newlib should be an array
- From: Steven Degutis <sbdegutis@...>
- Date: Tue, 16 Sep 2014 16:54:30 -0500
Quoth Alexander Nasonov:
> void luaL_newlib (lua_State *L, const luaL_Reg *l);
>
> is documented to be equivalent to
>
> (luaL_newlibtable(L,l), luaL_setfuncs(L,l,0))
>
> But since luaL_newlibtable() documents that its second argument
> must be an array, the luaL_newlib should inherit this requirement:
>
> void luaL_newlib (lua_State *L, const luaL_Reg l[]);
Hmm. I've always been very confused as to why luaL_newlibtable
explicitly requires an array. Especially when, in practice, luaL_Reg
arrays always end with a NULL-filled sentinel. It feels like overkill.
I'd love it if 5.3 would just choose one over the other and stick with
it consistently.
-Steven