diff --git a/inputters/lua.lua b/inputters/lua.lua index cc6713597..4e5bfa165 100644 --- a/inputters/lua.lua +++ b/inputters/lua.lua @@ -19,7 +19,7 @@ function inputter.appropriate (round, filename, doc) end function inputter.parse (_, doc) - local result, err = load(doc) + local result, err = load(doc, SILE.currentlyProcessingFile) if not result then SU.error(err) end diff --git a/packages/tableofcontents/init.lua b/packages/tableofcontents/init.lua index 7a6c0b835..248ce9d6c 100644 --- a/packages/tableofcontents/init.lua +++ b/packages/tableofcontents/init.lua @@ -38,12 +38,13 @@ function package.readToc (_) -- already loaded return SILE.scratch._tableofcontents end - local tocfile, _ = io.open(pl.path.splitext(SILE.input.filenames[1]) .. ".toc") + local tocfile_name = (pl.path.splitext(SILE.input.filenames[1]) .. ".toc") + local tocfile, _ = io.open(tocfile_name) if not tocfile then return false -- No TOC yet end local doc = tocfile:read("*all") - local toc = assert(load(doc))() + local toc = assert(load(doc), tocfile_name, "r")() SILE.scratch._tableofcontents = toc return SILE.scratch._tableofcontents end