added startup file
This commit is contained in:
		
							parent
							
								
									dfaabea00d
								
							
						
					
					
						commit
						1a523cb3ce
					
				
							
								
								
									
										21
									
								
								src/startup.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								src/startup.lua
									
									
									
									
									
										Normal 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
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user