|
|
@@ -13,8 +13,8 @@ function os.spawnfile(p,n,...) -- spawns a new process from file *p* with name * |
|
|
|
end |
|
|
|
_G.package = {} |
|
|
|
package.loaded = {computer=computer,component=component,fs=fs,buffer=buffer} |
|
|
|
function require(f) -- searches for a library with name *f* and returns what the library returns, if possible |
|
|
|
if not package.loaded[f] then |
|
|
|
function require(f,force) -- 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" |
|
|
|
for d in lib:gmatch("[^\n]+") do |
|
|
|
if fs.exists(d.."/"..f) then |
|
|
@@ -29,3 +29,6 @@ function require(f) -- searches for a library with name *f* and returns what the |
|
|
|
end |
|
|
|
error("library not found: "..f) |
|
|
|
end |
|
|
|
function reload(f) |
|
|
|
return require(f,true) |
|
|
|
end |