Guest User

colors

a guest
Aug 26th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.58 KB | None | 0 0
  1. -- Colors
  2. white = 1
  3. orange = 2
  4. magenta = 4
  5. lightBlue = 8
  6. yellow = 16
  7. lime = 32
  8. pink = 64
  9. gray = 128
  10. lightGray = 256
  11. cyan = 512
  12. purple = 1024
  13. blue = 2048
  14. brown = 4096
  15. green = 8192
  16. red = 16384
  17. black = 32768
  18.  
  19. function combine( ... )
  20.     local r = 0
  21.     for n,c in ipairs( { ... } ) do
  22.         r = bit32.bor(r,c)
  23.     end
  24.     return r
  25. end
  26.  
  27. function subtract( colors, ... )
  28.     local r = colors
  29.     for n,c in ipairs( { ... } ) do
  30.         r = bit32.band(r, bit32.bnot(c))
  31.     end
  32.     return r
  33. end
  34.  
  35. function test( colors, color )
  36.     return ((bit32.band(colors, color)) == color)
  37. end
Add Comment
Please, Sign In to add comment