local module = require(...)
local dictionary = {
["VALUE1"] = module.new()
}
How would I properly dispose of the dictionary value, aside from setting it to nil? Or would that be the most efficient. Would I need to add a function to the object where it sets clears and freezes itself?
Depends on if that object has anything that needs to be manually removed. For example, if that object creates a UI, a model, etc. yeah, you’d want to make a destroy method to remove it. If all that object has is variables, like self.SomeVariable = 5, then you don’t need to make a destroy method. Setting the table to nil will work just fine.
What? Garbage collection is built into Lua, and Roblox utilizes this as well. Doesn’t matter if it’s Luau or Lua. Simply google “Roblox Garbage Collection”
Garbage collection runs in the background with the task scheduler. It’s automatic.
I believe they were referring to the fact that the collectgarbage function has been heavily sandboxed. Luau’s garbage collector is discussed in the following articles.