View Single Post
04-17-09, 11:39 PM   #9
Sythalin
Curse staff
 
Sythalin's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 680
Originally Posted by Azul View Post
What is wrong with this? It says that bar is global, and that it's nil.. when obviously it should be local, and not nil..

Code:
local frame=CreateFrame("Frame")
frame:SetScript("OnUpdate",function(self)
	if not foo then
		local foo=1
		local bar="blah"
		local pi=3.14
		local text=""
	end
	text=foo..bar..pi
end)

I'm really starting to hate lua. I wish there was something else I could make addons in.
Since bar is declared locally in your IF statement, it won't be carried outside the block. Try putting it inside and see if it works.