View Single Post
09-08-08, 04:28 PM   #37
kerrang
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Oct 2006
Posts: 109
So a variable declared in a LOCAL function is still GLOBAL!? That's surprising and it means my function from earlier needs to be messy...

Code:
function test()
  local name,stack,duration,timeleft
  if IS_WRATH then
    name,_,_,stack,_,duration,timeleft = UnitBuff(target,n) 
  else
    name,_,_,stack,duration,timeleft = UnitBuff(target,n)
  end
  return name,stack,duration,timeleft
end
because
Code:
function test()
  if IS_WRATH then
    local name,_,_,stack,_,duration,timeleft = UnitBuff(target,n) 
  else
    local name,_,_,stack,duration,timeleft = UnitBuff(target,n)
  end
  return name,stack,duration,timeleft
end
wouldn't work of course (those variables being 'local' to that if statement only!
  Reply With Quote