Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local storagePrefix="str"
- local messagePrefix="con"
- function connectAllClients()
- allClients={}
- repeat
- local timer = os.startTimer(1)
- message=#allClients+1
- rednet.broadcast(messagePrefix..message)
- local event,id,message=os.pullEvent()
- if event=="rednet_message" then
- if message==storagePrefix..message then
- allClients[message]=id
- timedOut=false
- rednet.send(id,"Connection accepted")
- end
- elseif event=="timer" and id==timer then
- timedOut=true
- else
- timedOut=false
- end
- until timedOut==true
- return allClients
- end
- function getAllClientItems()
- if allClients==nil then
- connectAllClients()
- end
- allClientItems={}
- for id,data in ipairs(allClients) do
- rednet.send(id,"Requesting itemlist")
- repeat
- id,message=rednet.receive()
- until messageID==id
- itemString=message
- itemTable=toTable(itemString)
- allClientItems[id]=itemTable
- end
- return allClientItems
- end
- function toTable(tableString)
- end
- function fromTable(toStringTable)
- workTable=toStringTable
- fullString=""
- repeat
- for id,data in pairs(workTable) do
- end
- until type(data)~="table"
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement