libdo

Untitled

Sep 15th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.51 KB | None | 0 0
  1. function Button(pX, pY, pText, pColorText, pColorOn, pColorOff, pEnabled)
  2.     self = {X = pX, Y =pY, Text = pText, ColorText = pColorText, ColorBack = pColorOn, ColorOff = pColorBackOff, Enabled = pEnabled}
  3.    
  4.     local toggle = function()
  5.       self.Enabled = not self.Enabled
  6.     end
  7.    
  8.     local getState = function()
  9.       return self.Enabled  
  10.     end
  11.    
  12.    
  13.    
  14.     return {
  15.       toggle = toggle,
  16.       getState = getState
  17.     }
  18. end
  19.  
  20. b1 = Button(10, 10, "Hallo", 1, 2, 2, false)
  21. print(b1.getState())
  22. b1.toggle()
  23. print(b1.getState())
Add Comment
Please, Sign In to add comment