Browse Source

made require search the pkgfs if available

master
Izaya 2 years ago
parent
commit
45c70cbaa6
  1. 2
      module/loadfile.lua

2
module/loadfile.lua

@ -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)

Loading…
Cancel
Save