Files
Halyde/halyde/core/boot.lua
T
Ponali 6f1508d1bf v0.3.1 - Fixed the infamous bug
TheWahlolly didn't know that arrays were stored in pointers when set into another variable, affecting the original array. I also made some changes into the code for ocelot logs so signals are much clearer to investigate (I hope).
2025-04-08 19:55:23 +02:00

32 lines
938 B
Lua

local loadfile = ...
local filesystem = loadfile("/halyde/lib/filesystem.lua")(loadfile)
_G._OSVERSION = "Halyde 0.2.0"
function _G.import(module, ...)
local args = table.pack(...)
local modulepath
if module:find("^/") then
if filesystem.exists(module) then
modulepath = module
end
elseif filesystem.exists("/halyde/lib/"..module..".lua") then
modulepath = "/halyde/lib/"..module..".lua"
end
assert(modulepath, "module not found\npossible locations:\n/halyde/lib/"..module..".lua")
local handle = filesystem.open(modulepath)
local data = ""
local tmpdata = ""
repeat
tmpdata = handle:read(math.huge or math.maxinteger)
data = data .. (tmpdata or "")
until not tmpdata
return(assert(load(data, "="..modulepath))(table.unpack(args)))
end
--local handle = assert(filesystem.open("/bazinga.txt", "w"))
--assert(handle:write("Bazinga!"))
--handle:close()
import("/halyde/core/cormgr.lua")