mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
require overright
This commit is contained in:
@@ -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
|
||||
|
||||
8
utils/require_override.lua
Normal file
8
utils/require_override.lua
Normal 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
|
||||
Reference in New Issue
Block a user