[Dev-luatex] "error" in LuaTeX and Lua (again) and manual .diff

Jonathan Sauer Jonathan.Sauer at silverstroke.com
Tue May 6 17:27:32 CEST 2008


> > While the stack backtrace for code created using \directlua is now 
> > very readable, IMO the same cannot be said for code loaded via 
> > loadfile, at least when kpathsearch is involved. Then the stack 
> > backtrace contains the absolute path of each Lua file, making it
> > a mouthfull.
> But this could actually be useful, right?

Possibly, yes. Anyway, it is possible to shorten the file name in Lua,
so no change is required in LuaTeX itself:

function loadstring(file, chunkname)
	local f, e = io.open(file)
	if not f then
		return f, e
	local contents = f:read("*a")
	return loadstring(contents, "@" .. (chunkname or file))

(if the chunkname starts with "@", Lua thinks it is a file name when
displaying it in a stack backtrace)


More information about the dev-luatex mailing list