[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: What has happened to arg?
- From: Geoff Leyland <geoff_leyland@...>
- Date: Wed, 5 Jun 2013 18:47:42 +1200
On 5/06/2013, at 6:34 PM, Dirk Laurie <firstname.lastname@example.org> wrote:
> In that case there is a quick answer to the FAQ:
> Can a program tell whether it is being run from the command line
> or from a script?
> if (arg==nil) print
> "Running from the command line, unless you are trying to fool me."
I think I understand the opposite of your definition of "running from the command line" but that's not the point.
The point is the last time I tried to work out if a module was required or "lua module.lua"ed I think I used debug.getinfo, but you seem to be right...
$ lua test.lua
arg: table: 0x7f8b93409320
Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio