lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


One thing I would like to see is Lua script option parsing before executing the commands on the commandline.

Consider this;

File cmdline.lua (1 liner, dumping commandline):
for k,v in pairs({...}) do print(k,v) end

Now execute (dumping options twice):
C:\Temp>lua -e "for k,v in pairs({...}) do print(k,v) end print'----------'" -- cmdline.lua and some options
----------
1       and
2       some
3       options

C:\Temp>

The `-e` and `-l` options do not have access to the commandline arguments passed to the Lua script. I ran into this a couple of times, especially when debugging commandline scripts. The use would be similar to LuaCov [1] added to the commandline eg.

> lua -lluacov test.lua with some options

Where the debug tool (luacov in the example) can intercept the options passed to the script.

(unless there is an easy way around this that I didn't yet find)

Thijs

[1] https://github.com/keplerproject/luacov