First of all, I am sorry if this is a duplicate topic, this is because of my small brain (I dont know what this type of argument is)
local Teams = {
Lobbies = {
["LobbyName"] = teamName,
["Owner"] = player.UserId
}
}
I wanted to use table.insert on this type of argument above but I do not know how, I tried researching but Idk what that argument is called lol. Any help is appreciated
Your table is a dictionary, you shouldn’t use table.insert, it’ll make things complicated, you can instead do this
local Teams = {
Lobbies = {
["LobbyName"] = "sup",
["Owner"] = 123
}
}
print(Teams.Lobbies.LobbyName) -- This is going to print "sup"
Teams.Lobbies.Myself = "me" -- or Teams.Lobbies["Myself"] = "me"
print(Teams.Lobbies.Myself) -- This will print "me" because we inserted a new key -->
--> with a set value to the dictionary.
This will also insert it in the table but in a different way. If you really want to use table.insert() which I don’t understand you would use it for this you can use the option I showed to you before. But I recommend this option Aspecturu explained it correctly.
Hmm I wanted to make a matchmaking system which makes uses “dictionaries” ye thank you for remind me man to store info about the system, by Making a new team I like to add a new table that leads me to my 2nd question, is how do I set a different name for each argument inserted since I would not like to be every array to be the same name since it will most likely cause issues. Tnx for the info btw
yep just like what I said above, the purpose of table.insert is for a matchmaking system