Basically, I want to get a random value out of the table, but I don't want repeats, so I'm using table.remove(), is there a better way to do this or should I just continue with what I have and insert the values in later?
Values = {"Hi1", "Hi2", "Hi3", "Hi4", "Hi5", "Hi6"}
print(#Values) -- Returns 6 values
--Repeat x3 with different variable names
ChosenValue1 = Values[math.random(1, #Values)]
removethis1 = Values[ChosenValue1]
table.remove(Values, removethis1)
print(ChosenValue1, "Value1")
--
--At the end I check in table how many are left
print(#Values) --Returns 2, it is less, but it still picks ones that are already removed, how can I prevent this?
EDIT: Found out that removethis1 is nil, so therefore I guess, how do I get the location of ChosenValue1, or is there yet a better way to make sure there is no duplicates?

1 comment
https://scriptinghelpers.org/questions/22565/tableinsert-and-tableremove#26210