Passing table as vararg ( newbie question )
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Passing table as vararg ( newbie question )
- From: Colm Sloan <colmsloan@...>
- Date: 2009年9月19日 18:00:35 +0100
I just want to get access to var2 and var3.
Foo( var1,
{ var2, "var3" }
)
function Foo( firstvar, ... )
local v1, v2 = ... -- says that v1 (var2) is a table :(
-- test to see how deep this table goes
-- causes infinite loop
local table1 = ...
while ( type( table1 ) == "table" ) do
local x, y = table1
table1 = x
print( "\nanother table" )
end
end
What's going on here? Why can't I access var2 and var3? I'm sure I'm making some simple mistake. I tried {{table1}} but that made no difference. Any ideas?