lua-users home
lua-l archive

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


Just as a demonstration of the points made above ..

$ cat test.lua
#!LUA
print("["..table.concat({...}, ",").."]")
$ lua5.4 -l test -e 'print("SEP")' test.lua ARG1 ARG2
[test,./test.lua]
SEP
[ARG1,ARG2]


On Tue, 7 Dec 2021 at 10:46, Paul Ducklin <pducklin@outlook.com> wrote:
>If you also want to have a standalone
>version of this module, just use a main
>file where you require this module and
>execute the needed code.

It’s a “standalone module” (e.g. run a basic TCP server configured directly from the command line) that I am after.

If you need a main file that exists only to do something like...

 require(’tcpserver’).run(require(’args’).parse())

 ...then tcpserver.lua is not acting as a tandalone module, it’s just a regular module module.

It would be nice to be able to say something like...

lua tcpserver.lua -hexdump 127.0.0.1:8000

...in the case that no special tweaking of the tcpserver functionality is required.