All objects show the display duration, taken from self.data.durationInfo, as a label that gets updated ten times per second (= needed for a display that has a precision of one digit after the dot). Let's say our GetGameTimeSeconds() is 114.2, the displayed remaining duration would be 5.92345 seconds, rounded to and displayed as 5.9s.
Now the question: There is two ways of achieving it:
1) Registering one updater that iterates through all objects and sets their displayed durations
Addon:RegisterForUpdate("GenericUpdater", 100, OnUpdateHandler)
local curTime = GetGameTimeSeconds()
for objName, objData in pairs(Addon.objects) do
local durationDisplay = objData.durationInfo.endTime - curTime
-- some other stuff that needs to be checked onRegisteredUpdate, too, there are ~4-5 other tables that are iterated here
2) Registering an updater for every single object that updates it
-- genericObj is the class that all objects inherit their methods from
-- setting up the metatable, controls, etc.
genericObj:RegisterForUpdate(controlName, 100, genericObj.OnUpdate)
local durationDisplay = self.data['endTime'] - curTime -- (curTime being defined somewhere and stored
'globally' in the addon class)
-- create an instance of the class genericObj
local testObject = genericObj:New("SuperDuperTestObject")
In short words: Should I register an updater for every object, that only handles itself, or should I register a 'monster updater' for the whole addon that updates every object that is part of the addon by iterating through it using a loop?
Since the goal appears to be to update them simultaneously any way: I don't know of any benefit to making them all independently do the same thing when you could just have the parent refreshing function handle all of them at once.