github.com/arnodel/golua@v0.0.0-20230215163904-e0b5347eaaa1/lib/base/lua/select.lua (about) 1 print(select(1, 3, 2, 1)) 2 --> ~^3\t2\t1$ 3 4 print(select(2, 3, 2, 1)) 5 --> ~^2\t1$ 6 7 print(select(4, 3, 2, 1)) 8 --> = 9 10 do 11 local function f(i, ...) 12 return select(i, ...) 13 end 14 print(f(2, "a", "b", "c")) 15 --> ~^b\tc$ 16 end 17 18 print(pcall(select, 0, 1, 2)) 19 --> ~^false .* 20 21 print(select('#', 1, 2, 3)) 22 --> =3 23 24 print(pcall(select)) 25 --> ~false\t.*value needed 26 27 print(pcall(select, 'hello', 1, 2, 3)) 28 --> ~false\t.*integer or '#' 29 30 print(select(-1, 1, 2 , 3, 4)) 31 --> =4