[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: isLmark() segmentation violation
- From: Edgar Toernig <froese@...>
- Date: Tue, 04 Dec 2001 12:08:45 +0100
Taj Khattra wrote:
>
> On Tue, Dec 04, 2001 at 11:10:05AM +0100, Edgar Toernig wrote:
> >
> > PS: luaL_check_int is meant for arguments, not results.
>
> how can i typecheck the result then - i thought that
> luaL_check_int() would be sufficient to verify that
luaL_check_int is a helper function to check function arguments
and it simply raises an error like:
bad argument #1 to `funcname' (number expected, got string)
Not very suitable to fetch function results.
There are a lot of thing you can do: simply use lua_tonumber();
it will return 0 if the object wasn't a number. Or perform an
explicit check with lua_isnumber (accepts numbers and numeric
strings). Or use lua_rawtag(...)==LUA_TNUMBER. Anyway, you
have to handle non-number results somehow...
Ciao, ET.