Advertisement
Oleshe

Image server

Feb 11th, 2023
764
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.73 KB | None | 0 0
  1. local image = require('image')
  2. local event = require('Event')
  3. local raid = 'c50'
  4. local cmp = require('component')
  5. local modem = cmp.modem
  6. modem.open(1)
  7. local ms = require('ms')
  8. local wk = {}
  9. function draw()
  10.   i = #wk
  11.   require('component').gpu.set(1,25,'draw')
  12.   while i > 0 do
  13.     ms.draw(wk[i][2],wk[i][3],wk[i][1])
  14.     print(wk[i][2],wk[i][3],wk[i][1])
  15.     i = i - 1
  16.   end
  17. end
  18.  
  19. while true do
  20.   _,_,_,_,_, e1,e2,e3,e4,e5 = event.pull(99999,'modem_message')
  21.   if e1 == 'image' then
  22.     if e2 == 'set' then
  23.       wk[#wk+1] = {'/Mounts/'..get(raid)..'/'..e3,e4,e5,#wk+1}
  24.       draw()
  25.       modem.broadcast(1,'image','set',#wk)
  26.     end
  27.     if e2 == 'remove' then
  28.       wk[e3] = nil
  29.       draw()
  30.     end
  31.   end
  32. end
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement