[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: How to tell if running script directly?
- From: Kevin Martin <kev82@...>
- Date: Sat, 5 Apr 2014 12:39:30 +0100
On 5 Apr 2014, at 12:32, <tonyp@acm.org> wrote:
> I think a better solution is needed.
(This is 5.2, don't know 5.1 situation)
If some code is called through require, then the chunk has the name given to require as it's first argument, if executed, there are no arguments to the chunk.
So, for testing, I do
local requirename = …
if requirename then
return moduletable
end
--tests go here
Thanks,
Kev