[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Equivalent to __name__ == “_main__”?
- From: Paul Ducklin <pducklin@...>
- Date: Tue, 7 Dec 2021 09:46:20 +0000
>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.