Bootstrap

Lua-可变参数...与select()方法

local test = {}

function test:selectFunc1( ... )
	print(select("#",...))
	print(#{...})
	-- print(unpack({...}))
	print(...)
	print(select(1,...))
	print(select(-1,...))
	print(select(-2,...))
end

test:selectFunc1(1,"test",{})

结果: 

3
3
1    test    table: 0000000000fd9530
1    test    table: 0000000000fd9530
table: 0000000000fd9530
test    table: 0000000000fd9530
[Finished in 0.2s]

;