lua-users home
lua-l archive

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

How do you "check" for a boolean argument from the C api? For that matter, I want the argument to have a default value of 'false'. I see that there are a bunch of luaL_checkxxx() functions, but none for boolean. There is also the set of luaL_optxxx() functions and boolean is not there either.

Here is what I would like the Lua script to look like when calling my function:
        obj:Write( "Unlock", "comma, separated, list, of, arguments", true ) -- The last parameter is optional and is using the Lua built-in 'true' not a string.
Inside my bindings for this function:
        luaL_checkstring( L, command, 1 );
        luaL_checkstring( L, args, 2 );
        -- How do I make this optional and let the code above be valid?

I hope this makes sense. Thanks.
RJP Computing