From 5db20adefdfbbe50e14f9534ec46af0f9f00741e Mon Sep 17 00:00:00 2001 From: XeonSquared Date: Wed, 1 Jul 2020 14:31:00 +1000 Subject: [PATCH] more standard package stuff, plus package.alias --- module/loadfile.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/module/loadfile.lua b/module/loadfile.lua index e7d3037..0f77734 100644 --- a/module/loadfile.lua +++ b/module/loadfile.lua @@ -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