lua-users home
lua-l archive

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


> On Sat, Oct 5, 2019 at 11:36 PM Phil Leblanc wrote:
> 
> > So would you encourage developers to start using "return false, msg"
> > in case of error instead of return nil, msg ?
> >
> 
> No!
> The manual says that in Lua 5.4 "fail" equals to nil.
> So, other people's code might rely on it when using your module.

The manual says that "Currently, @fail is equal to @nil, but that may
change in future versions."

For old libraries and functions, changing nil to false may cause
incompatibilites. New libraries and functions, however, are free
to use false instead of nil. The new function 'debug.setcstacklimit'
in the standard library does that.

-- Roberto