Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local empaenger = 3
- local message = ""
- local modemside = "right"
- local senderId = 0
- function string:split(sSeparator, nMax, bRegexp)
- assert(sSeparator ~= '')
- assert(nMax == nil or nMax >= 1)
- local aRecord = {}
- if self:len() > 0 then
- local bPlain = not bRegexp
- nMax = nMax or -1
- local nField=1 nStart=1
- local nFirst,nLast = self:find(sSeparator, nStart, bPlain)
- while nFirst and nMax ~= 0 do
- aRecord[nField] = self:sub(nStart, nFirst-1)
- nField = nField+1
- nStart = nLast+1
- nFirst,nLast = self:find(sSeparator, nStart, bPlain)
- nMax = nMax-1
- end
- aRecord[nField] = self:sub(nStart)
- end
- return aRecord
- end
- function send()
- rednet.send(empaenger,message,true)
- print("senden")
- end
- function connect()
- if rednet.isOpen(modemside) == false then
- rednet.open(modemside)
- end
- end
- function recive()
- while true do
- local senderId, message, distance = rednet.receive()
- senderId = senderId
- message = message
- print(message)
- end
- end
- -- Main --
- connect()
- while true do
- local senderId, message, distance = rednet.receive()
- rednet.send(empaenger,message,true)
- os.sleep(0.0001)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement