Browse Source

more standard package stuff, plus package.alias

master
XeonSquared 3 years ago
parent
commit
5db20adefd
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      module/loadfile.lua

+ 4
- 2
module/loadfile.lua View File

@@ -9,9 +9,11 @@ function runfile(p,...) -- string -- -- runs file *p* with arbitrary arguments i
end

_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.path="/boot/lib/?.lua;/pkg/lib/?.lua;/boot/lib/?/init.lua;/pkg/lib/?/init.lua;./?;./?.lua;./?/init.lua"
package.loaded = {buffer=buffer, component=component, computer=computer, coroutine=coroutine, fs=fs, math=math, os=os, package=package, string=string, table=table}
package.alias = {filesystem="fs"}
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
f=package.alias[f] or f
if not package.loaded[f] or force then
local ln = f:gsub("%.","/")
for d in package.path:gmatch("[^;]+") do


Loading…
Cancel
Save