Greetings! I’m looking to create a function repeatedly loops over and over again after some amount of time, while completing some actions at the end of the duration. I have accomplished it as follows:
function Protocol:InitiateStart()
self.Timer:start(self.TurnTime) --starting the objects timer
self.Timer.finished:Wait() --waiting till the objects timer finishes
--print("Timer Ended")
--complete some other logic, send events, etc.
self:InitiateStart() --recursively restarting the timer
end
Currently this works, but I have a concern that if this keeps running over and over again, it will cause performance issues over time. I feel like since the newly called self:InitiateStart() is “inside” of the other self:InitiateStart(), the code would sort of “pile up” as the server would have to go through all the “layers” of self:InitiateStart().
I don’t know if my concerns are actually valid or just me being paranoid, and I haven’t observed any noticeable effects yet.
However, will this be a concern if the function is in its 100th/1000th/10000th loop? Or is there another, more effective way, for me to go about this that doesn’t involve recursively calling the function.

