I knew that local limited the variable to the scope just didn't know why everybody always typed local to variables out of any scope, not nested, and when I say everybody that includes myself, I typed local for these not nested variables automatically, only questioned myself about this today, and couldn't get it out of my head. Thank you! Just a quick doubt, luau was the first programming language I learned, got others later on, but Lua was the only language (from the ones I learned) that has this local thing, it's useful of course, but if declaring global variables as locals is that more performant why don't other programming languages, do this too? Is it that more performant? Wouldn't declaring the data types like Java or C++ be even more performant?
@branlan895 Жыл бұрын
Why do you make global variables local? It's understandable if the variable is within a function. But why local when variable is outside a function?
@BRicey Жыл бұрын
It’s faster performance wise
@romahkao Жыл бұрын
Yea otherwise it will have to index the variable from the environment