Guest User

control

a guest
Mar 25th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.68 KB | None | 0 0
  1. os.loadAPI("touch");
  2.  
  3. mon = peripheral.wrap("front");
  4.  
  5. local t1 = touch.new("front");
  6. local t = t1;
  7.  
  8. function writeButtons()
  9. t1:add("Cell 1", nil, 1, 1, 9, 2, colors.red, colors.lime);
  10. t1:add("Cell 2", nil, 11, 1, 19, 2, colors.red, colors.lime);
  11. t1:add("Cell 3", nil, 21, 1, 29, 2, colors.red, colors.lime);
  12. t1:add("Cell 4", nil, 1, 4, 9, 5, colors.red, colors.lime);
  13. t1:add("Cell 5", nil, 11, 4, 19, 5, colors.red, colors.lime);
  14. t1:add("Cell 6", nil, 21, 4, 29, 5, colors.red, colors.lime);
  15.  
  16. t = t1;
  17. t:draw();
  18. end
  19.  
  20. writeButtons();
  21.  
  22. while true do
  23. local event, p1 = t:handleEvents(os.pullEvent());
  24. if(event == "button_click") then
  25. t:toggleButton(p1);
  26. print(p1);
  27. end
  28. end
Advertisement
Add Comment
Please, Sign In to add comment