[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


Hello, 

> > 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
quite 
> > 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
	end
	local contents = f:read("*a")
	f:close()
	return loadstring(contents, "@" .. (chunkname or file))
end

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


Jonathan



More information about the dev-luatex mailing list