From e4b4501877d0a45aaa690ee1d47e51ba47d177ba Mon Sep 17 00:00:00 2001 From: Rob Thomson Date: Tue, 14 Oct 2025 09:06:54 +0100 Subject: [PATCH] Fix some loadfiles that where missed. --- scripts/dashx/main.lua | 4 ++-- scripts/dashx/tasks/tasks.lua | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/dashx/main.lua b/scripts/dashx/main.lua index de5d0aa..ea89af5 100644 --- a/scripts/dashx/main.lua +++ b/scripts/dashx/main.lua @@ -12,10 +12,10 @@ dashx.session = {} local dashx = {} package.loaded.dashx = dashx --- If you still want to ban accidental globals in this chunk: +-- Print warning if accidental global created local _ENV = setmetatable({ dashx = dashx }, { __index = _G, - __newindex = function(_, k) error("attempt to create global '"..tostring(k).."'", 2) end + __newindex = function(_, k) print("attempt to create global '"..tostring(k).."'", 2) end }) -- initialise legacy font if not already set (ethos 1.6 vs 1.7) if not FONT_M then FONT_M = FONT_STD end diff --git a/scripts/dashx/tasks/tasks.lua b/scripts/dashx/tasks/tasks.lua index d66f48c..ec6866d 100644 --- a/scripts/dashx/tasks/tasks.lua +++ b/scripts/dashx/tasks/tasks.lua @@ -175,7 +175,7 @@ end function tasks.initialize() local cacheFile, cachePath = "tasks.lua", "cache/tasks.lua" if io.open(cachePath, "r") then - local ok, cached = pcall(dashx.compiler.dofile, cachePath) + local ok, cached = pcall(dofile, cachePath) if ok and type(cached) == "table" then tasks._initMetadata = cached utils.log("[cache] Loaded task metadata from cache", "info") @@ -188,7 +188,7 @@ function tasks.initialize() for _, dir in pairs(system.listFiles(taskPath)) do if dir ~= "." and dir ~= ".." and not dir:match("%.%a+$") then local initPath = taskPath .. dir .. "/init.lua" - local func, err = compiler(initPath) + local func, err = loadfile(initPath) if err then utils.log("Error loading " .. initPath .. ": " .. err, "info") elseif func then @@ -221,7 +221,7 @@ function tasks.findTasks() for _, dir in pairs(system.listFiles(taskPath)) do if dir ~= "." and dir ~= ".." and not dir:match("%.%a+$") then local initPath = taskPath .. dir .. "/init.lua" - local func, err = compiler(initPath) + local func, err = loadfile(initPath) if err then utils.log("Error loading " .. initPath .. ": " .. err, "info") elseif func then @@ -230,7 +230,7 @@ function tasks.findTasks() utils.log("Invalid configuration in " .. initPath, "debug") else local scriptPath = taskPath .. dir .. "/" .. tconfig.script - local fn, loadErr = compiler(scriptPath) + local fn, loadErr = loadfile(scriptPath) if fn then tasks[dir] = fn(config) -- assumes global 'config' else @@ -428,7 +428,7 @@ function tasks.wakeup() if key then local meta = tasks._initMetadata[key] if meta.init then - local initFn, err = compiler(meta.init) + local initFn, err = loadfile(meta.init) if initFn then pcall(initFn) else @@ -436,7 +436,7 @@ function tasks.wakeup() end end local script = "tasks/" .. key .. "/" .. meta.script - local module = assert(compiler(script))(config) -- assumes global 'config' + local module = assert(loadfile(script))(config) -- assumes global 'config' tasks[key] = module if meta.interval >= 0 then