[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Function without return does not return nil?
- From: bil til <biltil52@...>
- Date: Thu, 9 Feb 2023 16:42:01 +0100
> > tostring(b())
> stdin:1: bad argument #1 to 'tostring' (value expected)
You can write tostring( b() or nil), or var=b(); tostring(var), or I
think also use select(#,b()) - which then should give 0 possibly (but
I did not try myself).
... there are quite many nice applications of the fact, that nil and
"none" are different. (C function lua_type also returns LUA_TNONE
(different from LUA_TNIL), and you can easily get the stack count by
lua_gettop... but the type() function I think would NOT return 'none',
presumably type(b(0)) might return 'nil' you have to try...).