[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: luaL_checkudata: Bug? Feature?
- From: roberto@... (Roberto Ierusalimschy)
- Date: Mon, 19 Jun 2006 16:59:00 -0300
> I've noticed that luaL_checkudata cannot be used with a negative stack
> index; that is, one relative to the top of the stack. The difficulty
> is that it fetches the metatable from the registry before it fetches
> the metatable from the userdata to be checked, so the stack depth
> has changed by the time it does that.
>From the manual (http://www.lua.org/manual/5.1/manual.html#4):
Several functions in the auxiliary library are used to check C
function arguments. Their names are always luaL_check* or luaL_opt*.
[...] Because the error message is formatted for arguments (e.g., "bad
argument #1"), you should not use these functions for other stack
values.
-- Roberto