lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


So recently I found out that local variables are always faster. So I have two questions, when would you ever need a global variable, and why would Lua make all variables global by default if you use local way more often? It seems to me that I could just declare a variable local right off the bat so it has the same scope as if it were global (I feel like there has to be a difference in scope that I just don’t know about).