lua-users home
lua-l archive

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


On Sun, Aug 28, 2011 at 7:38 PM, Gaspard Bucher <gaspard@teti.ch> wrote:
> Hi list,
> What is the simplest way to check a return value for false, doing the
> equivalent of the Lua code:
> val == false
> but with the C API...
>
> My best guess for the moment is:
> lua_isboolean(L, -1) && !lua_toboolean(L, -1)
> But maybe there is another way...
>                                                                Gaspard
>

If you push false onto the stack at a known index, you could use
lua_rawequal(). Otherwise I don't believe there is another way.

-Duncan