milo wip
This commit is contained in:
@@ -9,6 +9,8 @@ local turtle = _G.turtle
|
||||
local context = Milo:getContext()
|
||||
|
||||
local function client(socket)
|
||||
debug('connection from ' .. socket.dhost)
|
||||
|
||||
repeat
|
||||
local data = socket:read()
|
||||
if not data then
|
||||
@@ -32,8 +34,14 @@ local function client(socket)
|
||||
slot.index,
|
||||
slot.count)
|
||||
end)
|
||||
|
||||
local items = Milo:listItems()
|
||||
Milo:mergeResources(items)
|
||||
socket:write(items)
|
||||
end
|
||||
until not socket.connected
|
||||
|
||||
debug('disconnected from ' .. socket.dhost)
|
||||
end
|
||||
|
||||
if device.wireless_modem then
|
||||
@@ -41,9 +49,6 @@ if device.wireless_modem then
|
||||
debug('Milo: listening on port 4242')
|
||||
while true do
|
||||
local socket = Socket.server(4242)
|
||||
|
||||
debug('connection from ' .. socket.dhost)
|
||||
|
||||
Event.addRoutine(function()
|
||||
client(socket)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user