-- Conf.lua
function love.conf(t)
t.console = true
end
-- main.lua
local function foo(...)
for _,v in ipairs(arg) do
print(v)
end
end
foo("Hello", "you", 1, 2, 3)
-- Output: C:\Users\Lars\Desktop/Test
Why is the output the directory path instead of the passed variables in the foo function arguments?
Thanks for the help. (LÖVE 11.1, Atom Editor, Win10). (I feel so stupid)
The answer lies in the fact that the vararg expression is not accessed through a variable called arg anymore (since lua 5.1+, but even that didn't really support that), and arg in löve is a global in the main thread having the command line arguments in it.
You want to either use {...} or the select statement if you want to work with varargs.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Thanks, easiest answer you ever had to give I guess.
I didn't used it for quite some time and I can remember that this worked in the past. "Arg" is also used in the Lua PIL that is linked
in my bookmarks, maybe I should update the link. I go back to bed! n8