lua-users home
lua-l archive

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

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. I want to avoid doing something like the following in the function.

int my_c_function(lua_State *L)
    if (L == L1)
      printf("file 1 made the call");
   else if (L == L2)
      printf("file 1 made the call");

Does anyone know what is the most efficient way to do this ?