function printabc(a,b,c)
print(a,b,c)
end
local list = {1,2,3}
printabc(list)
The above code prints "table:1234567 nil nil"
Is there anyway way, without saying "print(list[1], list[2], list[3])", that the above format will work?
function printabc(a,b,c)
print(a,b,c)
end
local list = {1,2,3}
printabc(list)
The above code prints "table:1234567 nil nil"
Is there anyway way, without saying "print(list[1], list[2], list[3])", that the above format will work?
###You can't print a table. You can unpack it though.
local function printabc(a, b, c)
print(a, b, c)
end
local list = {1, 2, 3}
printabc(unpack(list)) -- will unpack the table and print its elements
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
Oh thank god. Awesome!