TSnake41/raylib-lua

`varargs` and the `arg` hidden parameter don't work correctly

chrg127 opened this issue · 1 comments

Hi, I think I've found an issue when trying to define a varargs function. Here's an example:

function util.pyprint(...)
    res = ""
    for k, v in ipairs(arg) do
        print("k = " .. tostring(k) .. ", v = " .. tostring(v))
        res = res .. tostring(v)
    end
    print(res)
end

This function is supposed to print variable argument and is intentionally similar to python's print. I added another print call for debugging purposes. When I run this function, with any kind and number of arguments, I get this output:

k = 1, v = test.lua
test.lua

(test.lua being the input file for raylua_s).

I've noticed I was looking at the docs for the wrong version of lua.