lua-users home
lua-l archive

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


> You may just rename "undefined"->"nil" and "nil"->"false":
>
> t = {}
> print(t["somesting"])    --> prints "nil"
> t["somesting"] = false
> print(t["somesting"])    --> prints "false"
>
> Both nil and false evaluate to false when used in an if statement.

Indeed, false as mostly-replacement for a first-class-nil has its
virtues, only exception is in a list of booleans with "unknown" or
"errornous" values.