lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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.