Fix start, join, formatting, and locale issues

This commit is contained in:
Cooldude2606
2024-11-14 23:59:22 +00:00
parent 48f55b0547
commit 9aee1c425f
29 changed files with 168 additions and 135 deletions

View File

@@ -8,8 +8,18 @@ local _require = require
-- This replace function is used to avoid additional lines in stack traces during control stage
local function replace()
require = function(path)
--- @cast path string
if package.lifecycle == package.lifecycle_stage.runtime then
return loaded[path] or loaded[path:gsub(".", "/")] or error("Can only require files at runtime that have been required in the control stage.", 2)
local replaced = path:gsub("%.", "/")
if not replaced:match("^__(.-)__") then
replaced = "__level__/" .. replaced
end
if not replaced:match(".lua$") then
replaced = replaced .. ".lua"
end
return loaded[path]
or loaded[replaced]
or error("Can only require files at runtime that have been required in the control stage.", 2)
else
return _require(path)
end