[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: How to "check" for a boolean function argument through the C api
- From: Etan Reisner <deryni@...>
- Date: Fri, 27 Jul 2007 18:52:40 -0400
On Fri, Jul 27, 2007 at 06:41:11PM -0400, RJP Computing wrote:
<snip>
> OK just so I have this strait, I can use the luaL_checkany() function? I
> guess what I am driving at is the ability to use the parameter as a boolean
> like in C++. My problem is then I have to do the type conversion. If I use
> luaL_checkint() I have to cast the value. This doesn't seem as useful as
> adding the functionality to luaxlib.h. Like you said it provides the higher
> level and it seems to miss boolean. On the same argument, if you are saying
> that you don't want to pidgin hole a boolean into a certain type, well the
> lua_isboolean() has already defined what a boolean should be. I am not
> trying to argue, just understand the motivation.
If all you want is the standard lua 'any value' vs. 'false/nil' testing
then you just use lua_toboolean directly. If you want the boolean values
only bit then you use lua_isboolean first. Which the refman for
lua_toboolean suggests.
> --
> Regards,
> Ryan
> RJP Computing
-Etan