How insert a table inside another table?

instead of using [1] [Pure Blaster] I want it to be just [PureBlaster], then it gets easier

i think MetaTables will help you do this.

You can use syntax sugar a.b instead of a["b"] if you wanted to do that to clean up your code instead of using a metatable. Or actually insert the keys into that table instead of in a nested one.

Can give me a example? Please i didnt understand, i need i way to dont need use table.insert, to put a table inside another

Perhaps this might help.

1 Like

It’s as simple as a table just existing in a table.

local table = {
   tA = {MoreTable = {Wow = 1},Value = "test"};
   tB = {};
}
print(table.MoreTable.Wow) -- Prints 1

Instead of using unpack, you can use this.

local Skills = ServerData[p.UserId].Skills
Skills[#Skills] = {
    [""..Name] = {
        ["Type"] = Type;
        ["Element"] = Element;
        ["Desc"] = Desc;
        ["Mana"] = Mana,
        ["Stamina"] = Stamina;
        ["Level"] = Level;
        ["MaxLevel"] = MaxLevel;
        ["Upcost"] = Upcost
    }
}
1 Like