[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [LuaJIT ffi] Misleading error message?
- From: Justin Cormack <justin@...>
- Date: Sun, 31 Jul 2011 16:55:31 +0100
On Sat, 2011-07-30 at 16:04 +0100, Thomas Lauer wrote:
> Well, I still think that allowing to compare any value (including ffi
> values) against the special case of nil would be a sensible thing to do.
>
> I imagine you won't go there so perhaps a hint in the ffi docs (if and
> when you find the time) might be a good idea.
>
> > If you really, really need to find out whether something is a nil
> > object without ever raising errors, then use 'type(v) == "nil"'.
>
> That's what I've done as a workaround.
>
Usually you can just test with 'if not v then ...' rather than if v ==
nil then ...', so actually comparing to nil is rarely needed, unless
false is a sane value...
Justin