lua-users home
lua-l archive

luaL_checktype

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


Hi All,
I'm using Lua 4.1 alpha in a project and I'm using luaL_checktype a lot
inside C functions called from Lua to check if the incoming parameter is of
the expected type.
What happened was that luaL_checktype was aborting the program with an error
message "bad argument #1 to `newImage' (image expected, got image)" followed
by the stack trace.
I put a printf inside luaL_checktype to see the values of the tag I was
passing to it (which was generated with lua_newtype(L,"image",LUA_TNONE))
and of the function lua_rawtag and it showed me 10 for my tag (I have some
other tags) and 0 for lua_rawtag (which is probably the value for
LUA_TNONE).
I then changed luaL_checktype to call lua_tag instead of lua_rawtag (file
lauxlib.c line 64) and now everything works just fine.
The question is: am I doing something wrong? Or it's a bug in luaL_checktype
or in lua_rawtag?
Thanks for the help,
Andre de Leiradella

AltStyle によって変換されたページ (->オリジナル) /