[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: lua_isfalse
- From: Duncan Cross <duncan.cross@...>
- Date: Sun, 28 Aug 2011 20:34:00 +0100
On Sun, Aug 28, 2011 at 7:38 PM, Gaspard Bucher <email@example.com> 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...
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.