require overright

This commit is contained in:
Cooldude2606
2019-08-09 16:44:27 +01:00
parent 6bab92f87f
commit 129b39bbb9
2 changed files with 12 additions and 0 deletions

View File

@@ -50,6 +50,10 @@ for index,path in pairs(files) do
end
-- Override the default require; require can no longer load new scripts
log('[INFO] Require Overright! No more requires can be made!')
require 'utils.require_override'
-- Logs all errors again to make it make it easy to find
log('[INFO] All files loaded with '..#errors..' errors:')
for _,error in pairs(errors) do log(error) end

View File

@@ -0,0 +1,8 @@
local loaded = _G.package.loaded
local raw_require = require
function require(path)
return loaded[path] or error('Can only require files at runtime that have been required in the control stage.', 2)
end
return raw_require