Re: Its okey or not?
"blogdron (BLOGDRON)" <[email protected]>
| Newsgroups | gmane.comp.lang.lua.general |
|---|---|
| Message-ID | <[email protected]> |
Thank you all ::) понедельник, 9 февраля 2026 г. в 21:06:14 UTC+3, Martin Eden: > > On 2026-02-09 18:21, blogdron (BLOGDRON) wrote: > > "function x() return end" not equal "function x() return nil end"? > > This case is for all Lua versions. > > Hello blogdron, > > Lua functions are not crippled "functions" from C or FORTRAN. > They return sequence of values. > > So "return nil, nil" is two values, "return nil" is one and "return" > is zero. You can even count this way. Somewhat similar to Church numerals. > > Funny part is that parenthesis () around sequence always return > sequence with one element. So zero sequence becomes sequence with one > "nil": > > Lua 5.5.0 Copyright (C) 1994-2025 Lua.org, PUC-Rio > > f = function() return end > > print(f()) > > > print((f())) > nil > > -- Martin > > -- You received this message because you are subscribed to the Google Groups "lua-l" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/lua-l/fd384a41-0bde-4238-a0cd-9f8431a86cefn%40googlegroups.com.