lua-users home
lua-l archive

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


Hello, folks!

Sorry if this is a FAQ. I'm stumbling on the following example with
Lua 5.1.4 and 5.1.5:

    $ lua -e 'function foo(a) return a, "d" end local tb = {
foo("ab"), foo("c") } print(table.concat(tb))'
    abcd

Why is the output neither "abdcd" nor "abc"? Why is the second return
value of the first foo() call swallowed by the table constructor while
the second foo() call is not?

LuaJIT 2.0.0 beta11 is giving exactly the same result.

I'm afraid the current behaviour is quite unintuitive. Opinions?

Thanks!
-agentzh