lua-users home
lua-l archive

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


> I may found a doc mistake on luaL_register:
> 
> http://www.lua.org/manual/5.1/manual.html#luaL_register
> 
> The indicator for this luaL_register shows:
> 
> 
> [-(0|1), +1, *m*]
> >
> 
> But due to the description, luaL_register pops nothing and may push 0 or 1.
> 
> So the indicator is suggested to be:
> 
> [-0, +(0|1), *m*]
> >
> 
> Is it?

When called with NULL, luaL_register uses the element at the top of
the stack, so the net effect is as if it pops 1 and pushes 1. (-1, +1)
is not the same as (0, 0), as the former makes clear that the function
needs an element on the top.

-- Roberto