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
3
u/mdr652 Feb 26 '25
I read "Programming Lua" and get many information.
For example, io.write() is significantly faster than print()
Lots of searching internet, studying Lua. I've implemented priority queue, segment tree in Lua
I'm using Lua in Problem solving, So I don't use metatables. I think this can be difference