This here is a function that does something. I have been trying to write out what it does and I couldn’t figure out what line 10 and 15 does. I know that it adds something into a table but how.
CreateConfiguration = (function(Configurations, Table) --gets the table of the first parameter print(Table) for i, v in pairs(Configurations:GetChildren()) do print(Table) --finds if the values classname is a value if string.find(v.ClassName, "Value") then --if it make its name a clone of its value print(Table) Table[v.Name] = v:Clone() --if it isnt and it is either a folder or configuration class print(Table) elseif v:IsA("Folder") or v:IsA("Configuration") then --then make the values name become Table[v.Name] = Functions.CreateConfiguration(v, Table) end print(Table) end return Table end),
The parameter configurations is a folder containing different value types for a gun.
the Table parameter is just an empty table that gets filled up. I wanna know how it is getting filled up what confuses me is that it goes to the spot in the table getting the current value being cycled throughs name but that line itself adds it to the table.
I suppose the question is asking how the table is being filled up, so that’s what I will attempt to answer, correct me if I got the question or even my answer wrong.
Things can be inserted into a table a couple of ways:
--You can set everything in place manually: local array = {1, true, "yes"} local dictionary = { ["Test"] = 1, ["Test2"] = true, ["Test3"] = "yes" } --You can do table.insert local array = {} table.insert(array, "yes") --printing the table out will show "yes" in it --Annd you can do this: local dictionary = {} dictionary["Test"] = 1 dictionary["Test2"] = true dictionary["Test3"] = "yes" --Printing this dictionary will have the same result with printing the first dictionary
hey you! have you ever heard of enes? if you are in trouble, better call enes!