lua-users home
lua-l archive

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

The function luaL_checkudata(L, index, name) exits with an error when the name does not correspond to the one in the metatable consulted.
However, I have a situation where this situation is not necessarily fatal for the program. Several types of userdata are possible and are processed in an if-elseif-else chain.
It is of course no great problem to copy the code from lauxlib.c, omit the call to lua_typerror and use the cannibalized code. But I would be happy to avoid such duplication.

Therefore this question: can it be considered for the next version/update of Lua to split luaL_checkudata? For example providing the boolean returning function:

int lua_isudata(lua_State *L, int narg, const char *tname)

After which luaL_checkudata simply can become:
#define luaL_checkudata(L,A,N)\

Imho this will bring more flexibility at negligable cost.

Hans van der Meer