Advertisement
k_goos

TestButtonAPI

Jan 17th, 2015
241
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. os.loadAPI("ButtonAPI")
  2.  
  3. function Button()
  4.         ButtonAPI.initMonitor()
  5.         ButtonAPI.addButton("button1", 2, 1, 4, 20, "test")
  6.         ButtonAPI.addButton("button2", 1, 10, 4, 10, "test02")
  7.         ButtonAPI.draw()
  8.         parallel.waitForAny(ButtonAPI.buttonClickEvent, EventHandler)
  9. end
  10. function EventHandler()
  11.     while true do
  12.         local event, name, x, y = os.pullEvent("button")
  13.         print("Event: " .. event .. " Name: " .. name .. " X: " .. x .. " Y: " .. y)
  14.     end
  15. end
  16.  
  17. Button()
Advertisement
RAW Paste Data Copied
Advertisement