I am passing arguments to a Lua script and retrieving them using:
local arg1, arg2 = ...
Now I'd like to use a different syntax, with free ordering, such that I can call:
./myscript.lua arg1=val1 arg2=val2
so I'm trying something like:
args = ...
params = {}
for i, k in pairs(args) do
p, v = split(a, "=")
params[p] = v
end
which doesn't work because args only gets the value of the first argument.
How can I retrieve all the arguments passed to the script in one go?
Note: the script is executed from C using lua_pcall.