forked from izaya/OC-PsychOS2
fixed some stupid require() behavior
This commit is contained in:
parent
42938cf125
commit
3c8ec4cabc
@ -13,6 +13,7 @@ function os.spawnfile(p,n,...) -- spawns a new process from file *p* with name *
|
||||
end
|
||||
_G.libs = {computer=computer,component=component}
|
||||
function require(f) -- searches for a library with name *f* and returns what the library returns, if possible
|
||||
if not _G.libs[f] then
|
||||
local lib = os.getenv("LIB") or "/boot/lib"
|
||||
for d in lib:gmatch("[^\n]+") do
|
||||
if fs.exists(d.."/"..f) then
|
||||
@ -21,9 +22,9 @@ function require(f) -- searches for a library with name *f* and returns what the
|
||||
_G.libs[f] = runfile(d.."/"..f..".lua")
|
||||
end
|
||||
end
|
||||
end
|
||||
if _G.libs[f] then
|
||||
return _G.libs[f]
|
||||
else
|
||||
error("library not found: "..f)
|
||||
end
|
||||
error("library not found: "..f)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user