[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Auto-detecting whether script is stand-alone or module?
- From: steve donovan <steve.j.donovan@...>
- Date: Fri, 4 Jan 2013 09:02:31 +0200
On Fri, Jan 4, 2013 at 3:39 AM, Patrick <patrick@spellingbeewinnars.org> wrote:
> What about arg[0], that should be the scripts name
That works very nicely for detecting whether a file was loaded as a
module or a function in my experience.
Something like:
-- module.lua
...
if arg[0]:match 'module%.lua$' then
... we are a program...
end
steve d.