Lua multiple assignment with tables

前端 未结 4 1903
伪装坚强ぢ
伪装坚强ぢ 2021-01-12 08:36

This code:

function foo()
    return 1, 2, 3
end

bar = {}

bar = {a, b, c = foo()}

produces:

bar.a = nil
bar.b = nil
bar.c         


        
4条回答
提交回复
热议问题