mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
simplify local modules loading
This commit is contained in:
parent
eb9a89ed96
commit
02578a6276
1 changed files with 4 additions and 0 deletions
|
|
@ -292,6 +292,10 @@ function __load_script(path, nocache)
|
|||
end
|
||||
|
||||
function require(path)
|
||||
if not string.find(path, ':') then
|
||||
local prefix, _ = parse_path(debug.getinfo(2).source)
|
||||
return require(prefix..':'..path)
|
||||
end
|
||||
local prefix, file = parse_path(path)
|
||||
return __load_script(prefix..":modules/"..file..".lua")
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue