Suggestions for Color handling improvements

I hate that color values are treated as R,G,B values instead of real objects. I have a suggestion on how it could be easily implemented in a way that is backwards compatible.

One of the beauties of Lua is how it treats objects, tables, and functions as "first class" values that you can assign and pass around. Using three separate values for color (r,g,b) defeats that great feature of Lua making colors extremely cumbersome to work with.

For example, I don't want to hard-code color values into setFillColor. I want to have a local constant at the top of my file giving the color values. So right now I'm doing a lot of stuff like this:

1
2
3
backgroundColor = {r=80,g=255,b=200}
...
obj:setFillColor( backgroundColor[r], backgroundColor[g], backgroundColor[b]);
views:1727 update:2011/9/18 20:20:08
corona forums © 2003-2011