lua-users home
lua-l archive

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


On Sat, Jun 20, 2009 at 6:59 PM, Hans van der Meer<H.vanderMeer@uva.nl> wrote:
> After which luaL_checkudata simply can become:
> #define luaL_checkudata(L,A,N)\
>     (!lua_isudata((L),(A),(N))||luaL_typerror((L),(A),(N)))

No it cannot, as it would not then return the address of the userdata,
and furthermore, macro arguments other than L would be used multiple
times, which is a definite no-no in the Lua core.

I would not name the new function lua_isudata, as:
1) there is already the similar sounding lua_isuserdata
2) the function can be implemented in the aux library, so it would
have luaL_ prefix
3) I'd prefer luaL_touserdata rather than luaL_isuserdata, so that it
returns the pointer or NULL rather than 1 or 0