Re: Modules with standalone main program
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Modules with standalone main program
- From: albertmcchan <albertmcchan@...>
- Date: 2018年2月24日 06:37:42 -0500
On Feb 24, 2018, at 6:30 AM, Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> wrote:
>> if ... then
>> print("I was included as a module")
>> return {}
>> end
>> print("I was executed as a program")
>
> Try lua mod.lua 1 2 3 .
>
As long as the command is NOT mod.lua mod 1 2 3,
I can test for required with select(1, ...) == 'mod', or simply (...) = "mod"
see http://lua-users.org/wiki/FloatSumFast