From 7755e64fb3b644f302f7b8b207ddf00cf9f5a5af Mon Sep 17 00:00:00 2001 From: David Foerster Date: Thu, 15 Feb 2024 18:53:43 +0100 Subject: [PATCH] Add assert() around loadfile() invocations --- src/data.lua | 2 +- src/tools.lua | 4 ++-- src/values.lua | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/data.lua b/src/data.lua index 66faf38..78699d4 100644 --- a/src/data.lua +++ b/src/data.lua @@ -12,4 +12,4 @@ if i < #arg then tex.error("zu viele Argumente. Erstes überflüssiges Argument: '" .. tostring(arg[i+1]) .. "'") end -return loadfile("values.lua", "t")(arg[i]) \ No newline at end of file +return assert(loadfile("values.lua", "t"))(arg[i]) diff --git a/src/tools.lua b/src/tools.lua index 5a50f0a..a3c7d98 100644 --- a/src/tools.lua +++ b/src/tools.lua @@ -33,7 +33,7 @@ elseif arg[curarg] ~= nil then end local d = require("schemadef") -local schema = loadfile("schema.lua", "t")(true) +local schema = assert(loadfile("schema.lua", "t"))(true) if gendoc then if standalone then @@ -94,7 +94,7 @@ end if validate then local res = 0 local prev_pcount = 0 - local values = loadfile("values.lua") + local values = assert(loadfile("values.lua", "t")) for i = curarg + 1,#arg do values(arg[i]) end diff --git a/src/values.lua b/src/values.lua index ea75c35..6d14f00 100644 --- a/src/values.lua +++ b/src/values.lua @@ -1,5 +1,5 @@ local d = require("schemadef") -local schema = loadfile("schema.lua", "t")(false) +local schema = assert(loadfile("schema.lua", "t"))(false) local skt = require("skt") local input = ...