27.09.2018, 08:43
There's no difference in using math.sin directly or caching it via local variable in LuaJIT. Both examples take the same amount of time to run. And there are not many scripts that need to calculate sine 1000000 times in a row
But, using local variables is a very good advice to avoid problems where some function overwrites a global variable with the same name and causes script errors.
But, using local variables is a very good advice to avoid problems where some function overwrites a global variable with the same name and causes script errors.