more standard package stuff, plus package.alias
This commit is contained in:
parent
d40ce731ef
commit
5db20adefd
@ -9,9 +9,11 @@ function runfile(p,...) -- string -- -- runs file *p* with arbitrary arguments i
|
|||||||
end
|
end
|
||||||
|
|
||||||
_G.package = {}
|
_G.package = {}
|
||||||
package.path="./?;./?.lua;/boot/lib/?.lua;/pkg/lib/?.lua;/boot/lib/?/init.lua;/pkg/lib/?/init.lua"
|
package.path="/boot/lib/?.lua;/pkg/lib/?.lua;/boot/lib/?/init.lua;/pkg/lib/?/init.lua;./?;./?.lua;./?/init.lua"
|
||||||
package.loaded = {computer=computer,component=component,fs=fs,buffer=buffer}
|
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
|
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
|
if not package.loaded[f] or force then
|
||||||
local ln = f:gsub("%.","/")
|
local ln = f:gsub("%.","/")
|
||||||
for d in package.path:gmatch("[^;]+") do
|
for d in package.path:gmatch("[^;]+") do
|
||||||
|
Loading…
Reference in New Issue
Block a user