Advertisement
Guest User

adsasa

a guest
Nov 22nd, 2014
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. os.loadAPI("h2touchpanel")
  2.  
  3. -- button_config: "name"(string) and "cmd"(function) are required.
  4. local bCfg = {}
  5. bCfg[1]={name="final phase", cmd=function() rs.setOutput("back", true) end}
  6. bCfg[2]={name="close", cmd=function() rs.setOutput("bottom", false) end}
  7. bCfg[3]={name="pass", cmd=myNewFunc}
  8. bCfg[4]={name="sleep", cmd=runProgram}
  9.  
  10. -- define function
  11. local myNewFunc = function() print("hello") end
  12. local runProgram = function() sleep(10) shell.run("hevo2.lua") end
  13.  
  14. local mon = term
  15. --local mon = peripheral.wrap("top")
  16.  
  17. -- makePanel(button_cfg, col, row, mon) returns Panel-object.
  18. local p1 = h2touchpanel.makePanel(bCfg, 2, 2, mon)
  19. p1:draw()
  20.  
  21. while true do
  22. local event, b1 = p1:pullButtonPushEvent() -- returns pushed Button-object
  23.  
  24. p1:drawPushedButtonEffect(b1) -- pushed effect
  25. b1:evalCmd() -- eval(run) function
  26. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement