1
0
mirror of https://github.com/Adorable-Catgirl/Zorya-NEO.git synced 2024-11-27 12:48:07 +11:00

Module init.

This commit is contained in:
Jane Roxanne 2019-09-10 19:02:04 -05:00
parent 9a4c6a94d7
commit fa5af0b295
24 changed files with 58 additions and 0 deletions

View File

View File

@ -0,0 +1,10 @@
; This module simply loads files.
; It registers both an internal and
; external library.
[ZORYA_MOD]
name=loadfile
modver=1.0
minver=2.0
maxver=*
author=Adorable-Catgirl
url=https://github.com/Adorable-Catgirl/Zorya-NEO

View File

View File

View File

View File

View File

View File

View File

View File

View File

@ -0,0 +1,23 @@
local component = component
local function loadfile(addr, file)
local handle = assert(component.invoke(addr, "open", file))
local buffer = ""
repeat
local data = component.invoke(addr, "read", handle, math.huge)
buffer = buffer .. (data or "")
until not data
component.invoke(addr, "close", handle)
local global = {}
for k, v in pairs(_G) do
global[k] = v
end
for k, v in pairs(OSEXPORT) do
global[k] = v
end
return load(buffer, "=" .. file, "bt", global)
end
EXPORT.loadfile = loadfile
MODULE.loadfile = loadfile
OSEXPORT.zorya = OSEXPORT.zorya or {}
OSEXPORT.zorya.loadfile = loadfile --For legacy purposes.

View File

@ -0,0 +1,10 @@
; This module simply loads files.
; It registers both an internal and
; external library.
[ZORYA_MOD]
name=loadfile
modver=1.0
minver=2.0
maxver=*
author=Adorable-Catgirl
url=https://github.com/Adorable-Catgirl/Zorya-NEO

View File

View File

View File

View File

View File

@ -0,0 +1,5 @@
local component = require("component")
local function openos_kload(env, fs)
ENV.BOOTFUNC = ENV.lib.loadfile(fs, "init.lua")
end

View File

@ -0,0 +1,10 @@
; This module simply loads files.
; It registers both an internal and
; external library.
[ZORYA_MOD]
name=loadfile
modver=1.0
minver=2.0
maxver=*
author=Adorable-Catgirl
url=https://github.com/Adorable-Catgirl/Zorya-NEO

View File

View File

View File

View File

View File

View File