fix: sandbox strips standard io, use Mods.lua.io (DMF engine backup); pcall the load-time dump

This commit is contained in:
2026-10-03 06:13:50 -04:00
parent 5862b9194f
commit 57ba90fe71
@@ -77,8 +77,9 @@ function mod:dump_breeds()
table.concat(tags, ","))
end
-- the mod sandbox strips the standard io library, go through DMF's engine backup
local path = "./../mods/AutoMark/breed_dump.txt"
local file, err = io.open(path, "w")
local file, err = Mods.lua.io.open(path, "w")
if file then
file:write(table.concat(lines, "\n"))
file:close()
@@ -88,4 +89,8 @@ function mod:dump_breeds()
end
end
mod:dump_breeds()
-- never let the dev dump break mod load
local ok, err = pcall(mod.dump_breeds, mod)
if not ok then
mod:echo("breed dump error:", tostring(err))
end