I came across something interesting today and realized that the system in which loops are used for can actually be “replicated” using a certain function structure.
My initial question, as the rest of this post’s content is simply a demonstration, is:
Is there a potential drawback of using “function loops” ASIDE normal-type loops (While, for, repeat)
(I use normal loops for pretty much every table-related operation in my game currently (Such as loading datastore keys or for iterating over an instance’s children/descendants)
Does using this ‘function loop’ present a bad practice? (I personally don’t have any issues at all with it) Worse performance or is it simply not convenient?
The point is, I have several scripts using these function loops (mainly for instances as of now, but I don’t think I feel confident without truly knowing what could be of loops and loop function differences.
The initial loop function only has to be called once and then cycle begins, just as how once a loop in started, it only has to be called once to continue until both of their target variables have reached a certain value.
Should I abandon the idea of integrating “looping functions?” I assume as of now that unless iterating for table/object searches or when the index value is quite high (Like counting down from 1,000+ Seconds and would be better placed in a loop, but then again -
I don’t think calling a minor function to count down every second from 1,000 would be any more demanding than a loop counting down for the same amount of time.
Is practically the same as: