How to index tabled info?

I’m wanting to create a table of a bunch of different values, using 3 numbers, but am unsure how I can use them as indexs.

Quick example:

function TextureInfo.Set(block, rotationInfo)
    print(rotationInfo)
end

returns

{
[1] = “0”,
[2] = “90”,
[3] = “0”
}

{
[1] = “90”,
[2] = “0”,
[3] = “0”
}

And I want to be able to use those numbers, and have them have a bunch of texture related info, like

local Table = {
    [0, 90, 0] = {
         ["Front"] = 1,
         ["Back"] = 3,
         ["Left"] = 1,
         ["Right"] = 2,
         ["Top"] = 4,
         ["Bottom"] = 4
    },
    [90, 0, 0] = {
         ["Front"] = 3,
         ["Back"] = 2,
         ["Left"] = 4,
         ["Right"] = 1,
         ["Top"] = 3,
         ["Bottom"] = 2
    }
}

and so on. Cause I basically need to store every rotation possible, and assign texture face values to each rotation, so each rotation has all 6 textures given their own index, which I then use to set specific texture for each face (not relevant to the question) but yeah

You could use a Vector3, like so:

function TextureInfo.Set(block: BasePart --[[just a guess]], rotationInfo: Vector3)
    print(rotationInfo)
end
-- Would print {0, 90, 0}, note that they are numbers
local Table = {
    [Vector3.new(0, 90, 0)] = {
         ["Front"] = 1,
         ["Back"] = 3,
         ["Left"] = 1,
         ["Right"] = 2,
         ["Top"] = 4,
         ["Bottom"] = 4
    },
    [Vector3.new(90, 0, 0)] = {
         ["Front"] = 3,
         ["Back"] = 2,
         ["Left"] = 4,
         ["Right"] = 1,
         ["Top"] = 3,
         ["Bottom"] = 2
    }
}
1 Like