Hi! So, I have a little funtion that returns a table of booleans, but I want the table to only contain true values.
local h1, offset_h1 = (color[1] and color[2]) or (color[1] and color[3]) or (color[2] and color[3]), (color[1] and color[3])
local h2, offset_h2 = (color[4] and color[5]) or (color[4] and color[6]) or (color[5] and color[6]), (color[4] and color[6])
local h3, offset_h3 = (color[7] and color[8]) or (color[7] and color[9]) or (color[8] and color[9]), (color[7] and color[9])
local v1, offset_v1 = (color[1] and color[4]) or (color[1] and color[7]) or (color[4] and color[7]), (color[1] and color[7])
local v2, offset_v2 = (color[2] and color[5]) or (color[2] and color[8]) or (color[5] and color[8]), (color[2] and color[8])
local v3, offset_v3 = (color[3] and color[3]) or (color[3] and color[9]) or (color[6] and color[9]), (color[3] and color[9])
local d1, offset_d1 = (color[1] and color[5]) or (color[1] and color[9]) or (color[5] and color[9]), (color[5] and color[9])
local d2, offset_d2 = (color[3] and color[5]) or (color[3] and color[7]) or (color[5] and color[7]), (color[3] and color[7])
You don’t have to worry about the color[index] stuff, just keep in mind that all the variables are either true, true ; true, false or false, false.
How would I make a table that looks like this:
local myTable = {
h1 = {true, false};
}
but does not contain tables like h1 if h1[1] is false?
Any help is appreciated!