View Single Post
10-07-15, 06:51 AM   #5
jeruku
A Cobalt Mageweaver
 
jeruku's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 223
As Phanx pointed out that is not necessary. If you are concerned about variable scoping you can use a do-end block.

Lua Code:
  1. local scopeA = 4
  2. do
  3.    local scopeB = 5
  4.    scopeA = scopeA + scopeB
  5. end
  6. print(scopeA, scopeB)
That will output "9 nil" since scopeB ended with the block.
__________________
"I have not failed, I simply found 10,000 ways that did not work." - Thomas Edison
  Reply With Quote