Page 2 of 2

Re: Picking a value from a table

Posted: Mon Nov 23, 2015 7:59 pm
by vrld
pgimeno wrote:You access the components like: boxes[1].colour[1] through boxes[n].colour[3]
Also, this.

Re: Picking a value from a table

Posted: Mon Nov 23, 2015 9:11 pm
by pgimeno
Oblivion_123 wrote:Ok, but that still doesn't answer my question, is there a way that I can use this info to figure out the colour of box. Do you know any way?
I don't understand what's what you want to figure out. boxes.colour[1] is the red component from 0 to 255, boxes.colour[2] is the green component, and boxes.colour[3] is the blue component. You can pass them to love.graphics.setColor if that's your question. Using unpack() would be more compact and probably more efficient, but since you're having trouble with this, better try component by component for now.

Re: Picking a value from a table

Posted: Mon Nov 23, 2015 9:35 pm
by s-ol
pgimeno wrote:
Oblivion_123 wrote:Ok, but that still doesn't answer my question, is there a way that I can use this info to figure out the colour of box. Do you know any way?
I don't understand what's what you want to figure out. boxes.colour[1] is the red component from 0 to 255, boxes.colour[2] is the green component, and boxes.colour[3] is the blue component. You can pass them to love.graphics.setColor if that's your question. Using unpack() would be more compact and probably more efficient, but since you're having trouble with this, better try component by component for now.

Actually love.graphics.setColor accepts a table as the only Parameter too.