[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: debug.getinfo( aLevel, 'S' ).source?
- From: Petite Abeille <petite_abeille@...>
- Date: Wed, 06 Aug 2008 23:11:23 +0200
Hello,
I'm using debug.getinfo( aLevel, 'S' ).source to discover where a
given piece of code has been loaded from so as to locate resources
relative to the source code location.
This works rather nicely when modules are loaded from individual files
through 'require'.
Unfortunately, when aggregating multiple modules into one luac file
and accessing that file with an explicit path, debug.getinfo doesn't
include any path information.
For example, assuming 'all-in-one.luac' is a luac aggregation of
several modules, the following invocation will not return any path
information:
% lua /path/to/all-in-one.luac
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 ].
In such case, shouldn't debug.getinfo reflect the path specified in
_G.arg[ 0 ] instead of defaulting to the module name as a source,
e.g.: shouldn't it return '@/path/to/all-in-one.luac' instead of
'@Module'?
Or am I missing something altogether?
FWIW, here is the code used to derive a source location (note the
debug.getinfo path):
http://dev.alt.textdrive.com/browser/HTTP/Bundle.lua#L38
Thanks in advance for any insights.
Cheers,
PA.
--
http://alt.textdrive.com/nanoki/