lua-users home
lua-l archive

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



On Aug 7, 2008, at 12:14 AM, Luiz Henrique de Figueiredo wrote:

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.

I see... so... compiling 'module.lua' into 'module.luac' will statically record '@module' as the source for that code in the luac file itself, right? From then on, debug.getinfo will always return '@module' as the source for that bytecode, irrespectively of the effective code provenance, correct?

In other words, if code is loaded from a lua file, one gets its location, if loaded from a luac file ones get the static information recorded at the time of compilation, irrespectively of where the luac bytecode was loaded from.

On the other hand... code coming from source or bytecode should be equivalent for all practical purpose, no? But, in the case of debug.getinfo at least, they seem to behave rather differently... hmmm...

Are you proposing otherwise?

At this conjuncture, yes... I would argue that debug.getinfo( 'S' ) should consistently return the effective source location of a piece of code, no matter if it's plain source or bytecode.

Just my 2¢ though.

Cheers,

PA.