Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I automate this and use the most efficient code for inserting things into table?

Asked by 5 years ago
Edited 5 years ago
local Tab = {Backpack = {}, Inventory = {} }

local Data = {
    Backpack = {MachineGun = {}, Pistol = {}, Poop = {}}, 
    Inventory = {Gatling = {}, ChineseImmigrints = {}},

}

for i,v in pairs(Data) do

end

-- I want Tab to be exactly like Data 
--So Tab would have Machine Gun, Pistol, Poop, and Inventory would have Gatling, Chinese Immigrints in the Tab
-- 100% efficiency

I couldn't think of a way it was just too confusing for me

1
This must be a troll. Why would you use such variables Despayr 505 — 5y
0
You can't really get the "most efficient" code for insertion because there are a few factors that you will need to know first such as table size and how much memory you have available. SteamG00B 1633 — 5y
1
Just iterate over every item once. This best performance you can get with this type of organization would be linear anyway. rens321 1 — 5y

Answer this question