[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Passing C struct values automatically to Lua
- From: steve donovan <steve.j.donovan@...>
- Date: Fri, 6 Nov 2009 14:53:00 +0200
On Fri, Nov 6, 2009 at 2:46 PM, Nevin Flanagan <Alestane@comcast.net> wrote:
> 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.
This is true, but the 'function' (or rather, chunk) which is executed
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 is
the script (path included, maybe) and arg...arg[#arg] are the