Advertisement
guitarplayer616

WaitForUpdates

Jun 3rd, 2015
388
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.55 KB | None | 0 0
  1. local tArgs = (...)
  2. if not tArgs then
  3.   print("Usage: AutoUpdate <ProgramName> <AdditionalArgs>")
  4.   error()
  5. end
  6. local handle = fs.open("startup","w")
  7. local code = [[
  8. local w = term.getSize()
  9. term.clear()
  10. while true do
  11.   local events = {os.pullEvent()}
  12.  
  13.   if events[1] == "key" and events[2] == 56 then
  14.     shell.run("pastebin run ".."]]..tArgs..[[")
  15.   end
  16.  
  17.   term.clear()
  18.   term.setCursorPos(1,1)
  19.   for _,v in ipairs(events) do
  20.     print( v..(" "):rep(w-#tostring(v)) )
  21.   end
  22. end
  23. ]]
  24. handle.write(code)
  25. handle.close()
  26. shell.run("startup")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement