lua-users home
lua-l archive

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

On 1/25/08, Ken Smith <> wrote:
> issue.  Should a function with no return statement return 'nil', or
> nothing?  Are they different semantically?

yes they are.

i think in this case the issue is if tostring() should return a value
even when it gets no parameter?

OTOH, the 'real best' approach is to document all.  in your example:

- nothing() could return no value
- tostring() gets exactly one paramenter

therefore,   tostring(nothing()) isn't safe according to the
documentation, you'd be expected to write tostring(nothing() or nil)