Re: Its okey or not?
"'Martin Eden' via lua-l" <[email protected]>
| Newsgroups | gmane.comp.lang.lua.general |
|---|---|
| Message-ID | <[email protected]> |
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/a6996a28-8d5b-45bb-8fc3-1c242859325f%40disroot.org.