Advertisement
VADemon

While program execution sample

Apr 7th, 2013
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.46 KB | None | 0 0
  1. local program = "tree"
  2. local text = "Press S to stop!"
  3.  
  4. local ready = true
  5. parallel.waitForAll(
  6.   function ()
  7.     while ready do
  8.       shell.run(program)
  9.     end
  10.   end,
  11.   function ()
  12.     while ready do
  13.       local event, key = os.pullEvent("key")
  14.       if key==31 then
  15.         ready=false
  16.         print("Stopping...")
  17.         shell.exit()
  18. --elseif key== /MOUSE RIGHT CLICK/ then print(text)
  19.       else
  20.         print(text)
  21.       end
  22.     end
  23.   end
  24. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement