Advertisement
Kijan

Counter

Oct 6th, 2017
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.15 KB | None | 0 0
  1. thick = 0.1
  2. size = 1
  3. function onLoad(save_state)
  4.   local button = {
  5.     click_function = "dud",
  6.     function_owner = self,
  7.     label          = 0,
  8.     position       = {0,thick,0},
  9.     scale          = {size, 1, size},
  10.     width          = 0,
  11.     height         = 0,
  12.     font_size      = 800,
  13.     color          = {0,0,0,0},
  14.     font_color     = {1,1,1,100}
  15.   }
  16.   if save_state ~= "" then button.label = save_state end
  17.   self.createButton(button)
  18.  
  19.   button.click_function = "add"
  20.   button.label = "+"
  21.   button.position = {1,thick,0}
  22.   button.width = 500
  23.   button.height = 1000
  24.   self.createButton(button)
  25.  
  26.   button.click_function = "sub"
  27.   button.label = "-"
  28.   button.position = {-1,thick,0}
  29.   self.createButton(button)
  30. end
  31.  
  32. function dud() end
  33.  
  34. function add() addsub(1) end
  35. function sub() addsub(-1) end
  36.  
  37. function addsub(x)
  38.   local buttons = self.getButtons()
  39.   buttons[1].label = tonumber(buttons[1].label) + x
  40.   if buttons[1].label < 0 then buttons[1].label = 0 end
  41.   self.editButton(buttons[1])
  42.   self.script_state = buttons[1].label
  43. end
  44.  
  45. function getCount()
  46.   local buttons = self.getButtons()
  47.   return buttons[1].label
  48. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement