[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Multiple Lua Script Files
- From: Ben Sunshine-Hill <sneftel@...>
- Date: Fri, 13 Jan 2006 19:16:03 -0800
On 1/13/06, Chris Gurtler <chris@scadaengine.com> wrote:
> I have an application which will load 2 or more Lua Script files and I
> would like to hold some data along with each script file.
>
> As an example, my application calls lua_dofile file for each script as
> follows :-
>
> lua_dofile(L1, "file_1")
> lua_dofile(L2, "file_1")
>
> Later in the code I have a function which is called from the script
> file, but I want to determine which file has made the call.
Well, you need to decide which you're REALLY trying to identify: the
file chunk which is at the top of your callstack, or the lua_State
it's executing in. For the former, you can use the debug functions.
The latter will require slightly more complicated methods (at least in
5.0).
Ben