lua-users home
lua-l archive

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


2016-07-25 0:44 GMT+02:00 Michael Nelson <mikestar1313@gmail.com>:

> IMHO, returning false,err is useful if and only if the function returns
> true,realdata  in the case of success--itself a useful idiom in cases where
> failure is common, and needed in the rare case where nil is valid data.
> Although in that case, I would redesign the function if I had control of the
> code. I feel that treating nil as valid data is in general A Bad Thing (TM)

There is one such case in the standard library: 'require'. A module that
loads successfully but returns nil, produces the return value "true".