Lua multiple assignment with tables -
this code:
function foo() return 1, 2, 3 end bar = {} bar = {a, b, c = foo()}
produces:
bar.a = nil bar.b = nil bar.c = 1
how can written get:
bar.a = 1 bar.b = 2 bar.c = 3
without having write this:
function foo() return 1, 2, 3 end bar = {} a, b, c = foo() bar = {a = a, b = b, c = c}
bar = {} bar.a, bar.b, bar.c = foo()
Comments
Post a Comment