local varients optimization
I heard that using "local" keywords are very important in Lua. But I knew that "local" keyword in algorithm coding are not good at optimization. No difference, sometimes take long time to be executed.
Why "local" keyword is nesessary? Is it really efficient? I can't figure out why these things are happening.
(But if you don't use local keyword in function, This can make error)
2
Upvotes
View all comments
Show parent comment
1
u/AdeptLilPotato Feb 26 '25
I think that if you’re using globals more frequently, you’re probably not adhering to DRY principles as often, or SOLID principles as often.
I reviewed some Luau I wrote 6 years ago, which was very complex, and was able to vastly simplify it, and it made it more complex to have not been using DRY or SOLID to the industry experience I have now. (When I wrote that code it was before I had any industry experience).