lua-users home
lua-l archive

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


> In such scenario, debug.getinfo will return something like '@Module'  
> as the source even though the source was loaded from 'all-in-one.luac'  
> as specified in _G.arg[ 0 ].

I'm no sure what you mean. But consider this example:

% luac a.lua b.lua 

% cat x.lua
f=assert(loadfile"luac.out")
print(arg[0],debug.getinfo(f,"S").source)

% lua /tmp/x.lua 
/tmp/x.lua   =(luac)

When combining several programs into one file, luac creates a hidden main
program that simply runs the given program. That hidden program in given
"=(luac)" as its source, in the absence of anything else that would be useful.
Like the other programs, the main program is precompiled and so keeps its
own notion of the source name. Changing the name of the file that contains
precompiled code does not affect the names stored in the files. Are you
proposing otherwise?