local Table = {Sao = 'S',Sao = 'U',Sao = 'C',Sao = 'K',Sao = 'S'} for i,v in pairs(Table) do print(i) end --Only Prints Sao Once I want it to print 5 times --[[ --]] --What Im triyng to do local Table = {Sao = 'S',Sao = 'U',Sao = 'C',Sao = 'K',Sao = 'S'} local AmountOfSao = 0 for i,v in pairs(Table) do if i == 'Sao' then AmountOfSao = AmountOfSao + 1 end end print(AmountOfSao) -- Should print 5
Basically I want to add all the index up and print a number how how many same indexes there are
AmountOfSao should print 5
Table indexes are unique; you cannot have duplicate/same indexes in a table Use an array or change each index in your Table