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