lua-users home
lua-l archive

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


From: Steve Dekorte
>
> David Jeske <jeske@chat.net> wrote:
> > Solutions that seem useful to me would be:
> >  - allowing "0" to be considered false
> >  - creating a "real false" value, which looks like nil, but takes
> >    up space.
>
> How about a tagmethod for boolean:
>
> ----------
> None = {}
>
> noneTag = newtag()
> settagmethod( noneTag, "boolean", function () return nil end)
> settag(None, noneTag)
> ----------

That's a nice technique. But the documentation doesn't mention a "boolean"
event (either for 3.2 or 4.0 alpha). Is it newer than the alpha, or have I
missed something? If there is a boolean method, is there also a string
and/or number method?

Paul.