Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tArgs = {...}
- --Clears monitor
- function monitorReset()
- monitor.clear()
- monitor.setCursorPos(1,1)
- end
- function split(str, delim, maxNb)
- if string.find(str, delim) == nil then
- return { str }
- end
- if maxNb == nil or maxNb < 1 then
- maxNb = 0
- end
- local result = {}
- local pat = "(.-)" ..delim.. "()"
- local nb = 0
- local lastPos
- for part, pos in string.gmatch(str, pat) do
- nb = nb + 1
- result[nb] = part
- lastPos = pos
- if nb == maxNb then
- break
- end
- end
- if nb ~= maxNb then
- result[nb + 1] = string.sub(str,lastPos)
- end
- return result
- end
- function commaValue(amount)
- local formatted = amount
- local swap = false
- if formatted < 0 then
- formatted = formatted*-1
- swap = true
- end
- while true do
- formatted, k = string.gsub(formatted, "^(%d+)(%d%d%d)", '%1,%2')
- if k == 0 then
- break
- end
- end
- if swap then
- formatted = "-"..formatted
- end
- return formatted
- end
- function sortTable(t)
- local keys = {}
- for k in pairs(t) do
- keys[#keys + 1] = k
- end
- table.sort(keys)
- local i = 0
- return function()
- i = i + 1
- if keys[i] then
- return keys[i], t[keys[i]]
- end
- end
- end
- function turtleControl(ident)
- event, id, message = os.pullEvent("rednet_message")
- message = tostring(message)
- Table = {}
- Table = kapi.split(message, ":")
- if Table[1] == ident then
- shell.run(Table[2])
- end
- end
- function broadcast(mess)
- rednet.broadcast(tostring(mess))
- end
- if tArgs[1] ~= nil then
- tArgs[1](tArgs[2])
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement