Re: LUAJIT varargs problem?
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: LUAJIT varargs problem?
- From: Jean-Claude Wippler <jcw@...>
- Date: Thu, 3 Jan 2008 10:46:10 +0100
--- begin of test.lua
function test(...)
for i=1, #arg do
print(arg[i])
end
end
test(1,2,3)
--- end of test.lua
[...]
luajitexe: stdin:4: attempt to get length of global 'arg' (a nil
value)
[...]
We can see that here luajit generated code tries to read the global
variable "arg" which does not exist.
function test(...)
for i=1, select("#",...) do
print((select(i,...)))
end
end
test(1,2,3)
(or use "{...}" to convert the varargs into a table)
-jcw