Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- RoboLib by Andronio
- local cmp = require("component")
- local comp = require("computer")
- local r = require("robot")
- local rl = {}
- local oth_time = comp.uptime()
- function rl.fc(component)
- if cmp.isAvailable(component) then
- return true
- else
- return false
- end
- end
- function rl.report(msg)
- print(msg)
- if rl.fc('tunnel') then
- cmp.tunnel.send(msg)
- end
- end
- function rl.CL(bool)
- if rl.fc('chunkloader') then
- if bool == true then cmp.chunkloader.setActive(true) end
- if bool == false then cmp.chunkloader.setActive(false) end
- end
- end
- function rl.getProgTime()
- local all_sec = comp.uptime() - oth_time
- local mins = math.floor(all_sec/60)
- local secs = math.floor(all_sec - mins*60)
- rl.report('Program Time: '..mins..' min. '..secs..' sec.')
- os.exit()
- end
- function rl.tblChk(value, tbl)
- for k, v in pairs(tbl) do
- if v == value then
- return true, k
- end
- end
- return false
- end
- return rl
Add Comment
Please, Sign In to add comment