Closed Dismalitie closed 5 months ago
It's not LuaRT Studio related.
When running a LuaRT script, here is what the arg
table contains :
arg[2]
=> command line argument at position 2 (ie the first argument provided for the script)arg[1]
=> command line argument at position 1 (ie the executing script path)arg[0]
=> The LuaRT interpreterWhen running from a compiled script, here is what the arg
table contains :
arg[2]
=> command line argument at position 2 (ie the second provided argument)arg[1]
=> command line argument at position 1 (ie the first provided argument)arg[0]
=> The running compiled script In standard Lua, the arg
table contains :
arg[2]
=> command line argument at position 2 after the script (ie the third provided argument)arg[1]
=> command line argument at position 1 after the script (ie the first provided argument)arg[0]
=> The executing script patharg[-1]
=> A Lua interpreter option arg[-2]
=> A Lua interpreter optionarg[-3]
=> A Lua interpreter optionarg[-4]
=> The Lua interpreterOh, I didn't even know that arg
existed in PUC-Lua!
In fact, there is no recommendation for the arg
table, because it is created by the Lua interpreter and not the Lua runtime library.
For the next version of LuaRT, I will provide an implementation for the arg
table closer to that of PUC Lua, for interpreted and compiled script (there won't be any differences anymore)
When using command line arguments in Studio, it is set as the 2nd index instead of the first. The first index returns the filepath that the script is running from. This is annoying since the whole point of the command line params feature is to help you test, but instead you have to make a sort of offset. It works normally when running from a separate command prompt:
I don't know if this is a debug feature but it just triggers me I guess.
Thanks for reading anyways! 👍