Picking a value from a table

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: Picking a value from a table

Post by vrld »

pgimeno wrote:You access the components like: boxes[1].colour[1] through boxes[n].colour[3]
Also, this.
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine
User avatar
pgimeno
Party member
Posts: 3550
Joined: Sun Oct 18, 2015 2:58 pm

Re: Picking a value from a table

Post 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.
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: Picking a value from a table

Post 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.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 203 guests