rzel / kahlua

Automatically exported from code.google.com/p/kahlua
0 stars 0 forks source link

... and "arg" do not work correctly in kahlua #4

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. define a function as so and run it in kahlua:
function f(...)
    for i, v in pairs(arg) do
        print (i, v)
    end
end
f(1,2,3,4,5)

What is the expected output? What do you see instead?
expected:
1 1
2 2
3 3
4 4
5 5
n 5

Kahlua instead throws a nullpointer exception:
java.lang.NullPointerException
    at se.krka.kahlua.stdlib.BaseLib.next(BaseLib.java:235)
    at se.krka.kahlua.stdlib.BaseLib.call(BaseLib.java:132)

Please use labels and text to provide additional information.

Arg should be automatically defined when ... is defined in a function, so
that you can reference the entire list or specific entries in the list of
extra arguments.

Original issue reported on code.google.com by KevinRLu...@gmail.com on 26 Nov 2008 at 7:39

GoogleCodeExporter commented 8 years ago
This is not a bug. Kahlua intentionally does not support the compatibility 
options
between lua 5.0 and lua 5.1.
If you want to use arg, you can simply add this line of code:
local arg = {...}

Original comment by kristofer.karlsson@gmail.com on 27 Nov 2008 at 12:50

GoogleCodeExporter commented 8 years ago
ah i see, thanks for the clarification :)

Original comment by KevinRLu...@gmail.com on 27 Nov 2008 at 7:20