1
1
mirror of https://git.shadowkat.net/izaya/OC-PsychOS2.git synced 2024-12-25 12:15:26 -05:00

made require search the pkgfs if available

This commit is contained in:
XeonSquared 2020-06-06 19:49:26 +10:00
parent 89ab49faf6
commit 45c70cbaa6

View File

@ -15,7 +15,7 @@ _G.package = {}
package.loaded = {computer=computer,component=component,fs=fs,buffer=buffer}
function require(f,force) -- string boolean -- table -- searches for a library with name *f* and returns what the library returns, if possible. if *force* is set, loads the library even if it is cached
if not package.loaded[f] or force then
local lib = os.getenv("LIB") or "/boot/lib"
local lib = os.getenv("LIB") or "/boot/lib\n/pkg/lib"
for d in lib:gmatch("[^\n]+") do
if fs.exists(d.."/"..f) then
package.loaded[f] = runfile(d.."/"..f)