Failip420

api/ButtonAPI.lua

Dec 28th, 2020 (edited)
448
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.45 KB | None | 0 0
  1. function New(xx, yy, text, func, m, textcolor, textbgcolor)
  2.     m.setCursorPos(xx, yy)
  3.     m.setBackgroundColor(textbgcolor)
  4.     m.setTextColor(textcolor)
  5.     m.write(text)
  6.     m.setBackgroundColor(colors.black)
  7.     local Event = {os.pullEvent()}
  8.     if Event[1] == "monitor_touch" then
  9.         x = Event[3]
  10.         y = Event[4]
  11.         if x > xx - 1 and x < xx + string.len(text) and y == yy then
  12.             func(text)
  13.         end
  14.     end
  15. end
Add Comment
Please, Sign In to add comment