Hi, how do you “add” (not trying to set) a string value to the Key “Items”?
local tab = {
userid = {
[“Experience”] = 0,
[“Items”] = “DefaultItem”,
[“Cash”] = 0
}}
Hi, how do you “add” (not trying to set) a string value to the Key “Items”?
local tab = {
userid = {
[“Experience”] = 0,
[“Items”] = “DefaultItem”,
[“Cash”] = 0
}}
You cannot add more “items” to a string, is an array what you are looking for?
like
local tab = {
userid = {
Items = {"item1","item2"}
...
yeah, im trying to do it like this. is this possible on another method then?
Can you elaborate more on what you mean by “another method”?
Sorry, I misunderstood what you just said. I guess an array is what I was looking for, but how exactly to add new “items” into an array?
table.insert(tab["userid"]["Items"], #tab["userid"]["Items"] + 1, value )
or
table.insert(tab.userid.Items, #tab.userid.Items + 1, value)
I personally use dictionaries, so key-value pairs so I’d do
tab.userid.Items["Slot1"] = "item"
this worked thanks!