cc-haxe/src/startup.lua
2023-07-27 20:15:41 +02:00

22 lines
490 B
Lua

-- Check for startup enable flag
if redstone.getInput("top") then
local fd = fs.open("/haxe.lua", "r")
local haxe = fd.readAll()
fd.close()
local make = dofile("rom/modules/main/cc/require.lua").make
local env = {}
env.require, env.package = make(env, "/")
env = setmetatable(env, { __index = _G })
local f,err = load(haxe,"Haxe",nil,env)
if err then
print("Error loading Haxe: " .. err)
else
f()
os.reboot()
end
end