Originally Posted by jeruku
As Phanx pointed out that is not necessary. If you are concerned about variable scoping you can use a do-end block.
Lua Code:
local scopeA = 4 do local scopeB = 5 scopeA = scopeA + scopeB end print(scopeA, scopeB)
That will output "9 nil" since scopeB ended with the block.
|
Thank you for pointing me guys, I just like to separate my code in to blocks (I like this way of code organization), so in my AddOn, all my code packed in to different functions.
I never programmed before, so I don't know any languages at all, only a bit of lua, and I'm learing the best practice. And for sure, i want to write my code well and in correct way.
But even when i see Blizzard's code (who could think, it's one of the top game company in a world, and most known company), and their interface code looks messy in some files, and style of code different, and looks like that they don't even have a code standard, I find this very strange. Same thing about graphic UI standard, there are lot's of little bugs or mess.