made require search the pkgfs if available
This commit is contained in:
parent
89ab49faf6
commit
45c70cbaa6
@ -15,7 +15,7 @@ _G.package = {}
|
|||||||
package.loaded = {computer=computer,component=component,fs=fs,buffer=buffer}
|
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
|
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
|
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
|
for d in lib:gmatch("[^\n]+") do
|
||||||
if fs.exists(d.."/"..f) then
|
if fs.exists(d.."/"..f) then
|
||||||
package.loaded[f] = runfile(d.."/"..f)
|
package.loaded[f] = runfile(d.."/"..f)
|
||||||
|
Loading…
Reference in New Issue
Block a user