lua-users home
lua-l archive

Re: [ANN] Lua 5.3.0 (final) now available

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


2015年01月14日 2:59 GMT-02:00 Dirk Laurie <dirk.laurie@gmail.com>:
2015年01月14日 2:06 GMT+02:00 Aapo Talvensaari <aapo.talvensaari@gmail.com>:
> One correction to docs:
>
> utf8.len docs say:
>
> "If it finds any invalid byte sequence, returns a false value plus the
> position of the first invalid byte."
>
> It actually seems to return nil (which is of course evaluated as false when
> not compared equality to false).

I.e. nil is "a false value" in just about every context, e.g. §3.4.5
"all logical operators consider both false and nil as false".

The manual also sometimes states "returns false",

I understand the intended meaning of "return a false value" in the docs, but I also understand Aapo Talvensaari's comment because "false value" name it as a value (and Lua has a value for "false"), but nil, despite a value in Lua, means "Not a Value", or none of the possible values. In a closed context, which is mostly the case, nil may be interpreted as "false", that is, negation by failure.

--
Fidelis Assis

AltStyle によって変換されたページ (->オリジナル) /