lua-users home
lua-l archive

Re: Implementing __index to return nil?

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


Quoth Coda Highland <chighland@gmail.com>, on 2013年02月14日 14:54:02 -0800:
> There's no difference. nil means no value. In terms of Lua code,
> failing to return anything means that the function is treated as
> returning nil.
This is not true in general, though it's true much of the time.
In a context that expects exactly one value, such as __index
return values, returning nothing gets adjusted to a single nil.
So they are the same in this case.
 ---> Drake Wilson

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