Table.clear in dictionaries

Hello everyone! I hope you are feeling well today! :smiley:

Question: Is it safe to use table.clear in dictionaries? Will it have the same effect that it has in “arrays”, where it keeps the size of the table?

The reason why I ask is because most of the functions of the table library only work for “arrays” (the tables that has keys as numbers).

In other words:

  • Array:
    local Array = {"Hello!", true, 500}
    table.clear(Array)
    
  • Dictionary: (Once again, is it safe to clear a dictionary using table.clear to keep its allocated memory?)
    local Dictionary = {
     Text = "Hello!",
     Bool = true,
     Number = 500,
    }
    
    table.clear(Dictionary)
    
1 Like

Yes, it’s perfectly safe to do so.

2 Likes