|
On Fri, Nov 6, 2009 at 2:46 PM, Nevin Flanagan <Alestane@comcast.net> wrote:This is true, but the 'function' (or rather, chunk) which is executed
> If you have access to the debug library inside your Lua environment,
> debug.getinfo contains a function that you can use to retrieve information
> like what name the function was called from.
when your script runs is anonymous.
However, the arg table is always available if your code runs as a
script. The caveat is that this applies to the Lua executable itself;
it may not make sense in an embedded environment (but then you could
set a helpful global)
For plain Lua, arg[-1] is the path of the Lua executable, arg[0] is
the script (path included, maybe) and arg[1]...arg[#arg] are the
command-line arguments.
steve d.