added startup file

This commit is contained in:
Djeeberjr 2023-07-27 20:15:41 +02:00
parent dfaabea00d
commit 1a523cb3ce

21
src/startup.lua Normal file
View File

@ -0,0 +1,21 @@
-- 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