lua-users home
lua-l archive

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

For debugging my app, I've been reporting the error string returned by
lua_pcall when my  scripts fail.

The error usually looks something like this:
[string "path/file.lua"]:168: attempt to call global 'SomeFunc' (a nil
value)., where "path/file.lua" seems to be the chunkname I pass to

The problem I'm having is that my application has instances of lua
files that are in deeply nested directories, or have really long file
names. In these cases, the string "path/file.lua" gets truncated with
a ...
(e.g. "top/next/another/more/keep/going/fi...)

Often, I can see part of the path, but the lowest part of the path and
the filename are truncated which makes it hard to locate the file. My
application also has different lua scripts with the same name, but in
different directories, so just reporting the file name as the
chunkname doesn't help me too much.

I was wondering if there was a way I could prevent Lua from truncating
this information (preferably without having to modify Lua itself).

Or if this isn't possible, is there a way I can manually retrieve the
chunkname (in C) from the lua_State* and directly report it myself?