View Single Post
01-18-14, 10:50 AM   #6
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Well, that's a pretty useless error message... I can't tell whether it's complaining that you need to actually write "function(unit, cache, textframe)" and "end" around the text, or whether it's complaining that it's not getting a string (which could only happen if it's being stupid and calling the function for a nonexistent unit, such as the target unit when you aren't targeting anything). Try adding either the blue parts or the green parts, or maybe both:

Code:
function(unit, cache, textframe)
	local name, _, text = UnitCastingInfo(unit)
	if not name then
		name, _, text = UnitChannelInfo(unit)
	end
	if not name then
		name = UnitName(unit)
	end
	return text or name or ""
end
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote