1
1
mirror of https://git.shadowkat.net/izaya/OC-PsychOS2.git synced 2024-11-22 20:10:34 -05:00

Compare commits

..

No commits in common. "be3d3c207fd7a433c99db67337eed42049154a7f" and "5e9baee9fa265ace952bcb93366947c1a7037b8c" have entirely different histories.

View File

@ -12,16 +12,15 @@ function os.spawnfile(p,n,...) -- string string -- number -- spawns a new proces
return os.spawn(function() local res={pcall(loadfile(p), table.unpack(tA))} computer.pushSignal("process_finished", os.pid(), table.unpack(res)) dprint(table.concat(res)) end,n or p) return os.spawn(function() local res={pcall(loadfile(p), table.unpack(tA))} computer.pushSignal("process_finished", os.pid(), table.unpack(res)) dprint(table.concat(res)) end,n or p)
end end
_G.package = {} _G.package = {}
package.path="./?;./?.lua;/boot/lib/?.lua;/pkg/lib/?.lua;/boot/lib/?/init.lua;/pkg/lib/?/init.lua"
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 ln = f:gsub("%.","/") local lib = os.getenv("LIB") or "/boot/lib\n/pkg/lib"
for d in package.path:gmatch("[^;]+") do for d in lib:gmatch("[^\n]+") do
local p = d:gsub("%?",ln) if fs.exists(d.."/"..f) then
if fs.exists(p) and not fs.isDirectory(p) then package.loaded[f] = runfile(d.."/"..f)
package.loaded[f] = runfile(p) elseif fs.exists(d.."/"..f..".lua") then
break package.loaded[f] = runfile(d.."/"..f..".lua")
end end
end end
end end