TASVideos :: View topic
BRANK

Lua internalsAlright, lets start from some info about Lua internals.As for many other script languages, each mention of some variable in some Lua expression is actually taking time to get its value. For example, if I write following code:Language: Luafor i = 0, 10 doprint(i)endIt takes some time to get value of i and pass it into print. More important that here print is also variable. It's so called global variable. Here it's storing API function provided by environment. So, getting print function is also taking time. Again, more important, that taking here value of print is much slower than taking value of i. Because i here is local variable.Local variables is working faster than global variables, mostly because local variables doesn't have name in runtime, instead of that, they have indexes. And all actions "take local variable value" is just getting value by index, which is fast. On the other hand, global variables are stored in _G table. It's global table for all global variables.…

tasvideos.org
Related Topics: Lua