This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Lua Essentials
#7
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 Smile

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.
Reply


Messages In This Thread
Lua Essentials - by rocfusion - 01.07.2015, 14:37
RE: Lua Essentials - by edgars - 02.07.2015, 08:16
RE: Lua Essentials - by rocfusion - 25.02.2016, 09:04
RE: Lua Essentials - by Hugo - 14.09.2020, 12:32
RE: Lua Essentials - by buuuudzik - 27.09.2018, 06:21
RE: Lua Essentials - by admin - 27.09.2018, 07:01
RE: Lua Essentials - by buuuudzik - 27.09.2018, 08:10
RE: Lua Essentials - by admin - 27.09.2018, 08:43
RE: Lua Essentials - by rogerabit - 28.01.2019, 08:37
RE: Lua Essentials - by admin - 28.01.2019, 09:08
GOTO statement - by fabiorusco - 08.05.2021, 19:29
RE: Lua Essentials - by Erwin van der Zwart - 09.05.2021, 08:14
RE: Lua Essentials - by fabiorusco - 09.05.2021, 08:47

Forum Jump: