Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("ocs/apis/sensor")
- prox = sensor.wrap("right")
- function print_r ( t )
- local print_r_cache={}
- local function sub_print_r(t,indent)
- if (print_r_cache[tostring(t)]) then
- print(indent.."*"..tostring(t))
- else
- print_r_cache[tostring(t)]=true
- if (type(t)=="table") then
- for pos,val in pairs(t) do
- if (type(val)=="table") then
- print(indent.."["..pos.."] => "..tostring(t).." {")
- sub_print_r(val,indent..string.rep(" ",string.len(pos)+8))
- print(indent..string.rep(" ",string.len(pos)+6).."}")
- else
- print(indent.."["..pos.."] => "..tostring(val))
- end
- end
- else
- print(indent..tostring(t))
- end
- end
- end
- sub_print_r(t," ")
- end
- while (true) do
- details = prox.getTargetDetails("4,-1,0")
- if (details["StoredPercentage"] > 75) then
- print("Energyzufur wird abgeschaltet...")
- redstone.setOutput("left", true)
- elseif (details["StoredPercentage"] < 50) then
- print("Energyzufur wird eingeschaltet..." .. details["StoredPercentage"])
- redstone.setOutput("left", false)
- end
- os.sleep(5)
- end
Add Comment
Please, Sign In to add comment