Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function split(pString, pPattern)
- numchanged = 0
- local Table = {} -- NOTE: use {n = 0} in Lua-5.0
- local fpat = "(.-)" .. pPattern
- local last_end = 1
- local s, e, cap = pString:find(fpat, 1)
- while s do
- if s ~= 1 or cap ~= "" then
- table.insert(Table,cap)
- numchanged = numchanged +1
- end
- last_end = e+1
- s, e, cap = pString:find(fpat, last_end)
- end
- if last_end <= #pString then
- cap = pString:sub(last_end)
- table.insert(Table, cap)
- numchanged = numchanged +1
- end
- return Table
- end
- rednet.open("right")
- while true do
- id, msg = rednet.receive()
- command = split(msg,",")
- turtle.select(tonumber(command[2]))
- if command[1] == "f" then
- turtle.dig()
- turtle.place()
- elseif command[1] == "t" then
- turtle.digUp()
- turtle.placeUp()
- elseif command[1] == "d" then
- turtle.digDown()
- turtle.placeDown()
- else
- print("Error, incorrect command")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement