Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scripts/dashx/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions scripts/dashx/tasks/tasks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -428,15 +428,15 @@ 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
utils.log("Failed to load init for " .. key .. ": " .. (err or "unknown error"), "info")
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
Expand Down