Modules with standalone main program
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Modules with standalone main program
- From: Dirk Laurie <dirk.laurie@...>
- Date: 2018年2月24日 10:25:10 +0200
This has come up before, but I can't remember or find the answer.
Is there a test that allows the following logic?
----
if test then -- module was invoked by 'require'
return module
end
-- continue with main program
----
The best I can come up with is to insist on 'lua -i' for the
standalone, and use os.exit if I don't want to fall back to Lua.