I know this is a simple question, just trying to make my code a little more optimized!
By the way I will be calling the “Attack()” function a lot, so my question is making variables for it be better in the long run?
The second one would technically be more optimized for repeat access but it does not matter in the long run. For you to have any noticeable difference in performance between the two, it would take millions or more iterations.
It’s also not viable to write out a local variable for each element in the table as it grows. There’s also the issue of the variables caching the values and not passing current numbers to the function if the value ever changes.
tl;dr dont waste your time with caching everything to a variable