Originally Posted by sharp230
Hello,
I'm a new programmer, and just trying to complete what I thought would be a simple task. I want to print "You've targeted <UnitName>" each time I select a new target. I cannot get this to work. My code is below:
Code:
local UIConfig = CreateFrame("Frame")
UIConfig:RegisterEvent("PLAYER_TARGET_CHANGED")
UIConfig:SetScript("OnEvent",
function(self, event, ...)
local arg1 = ...
print("TEST")
end
I can't even get it to print "TEST" when I target something. If someone could give me a hint, I can figure out the rest, I've just been pulling my hair out for the past two days over this.
Edit: This is for WoW Classic
|
If this is all the code then you're probably getting an error because of the missing bracket after the last "end" to close the SetScript call.
Lua Code:
local UIConfig = CreateFrame("Frame")
UIConfig:RegisterEvent("PLAYER_TARGET_CHANGED")
UIConfig:SetScript("OnEvent", function(self, event, ...)
local arg1 = ...
print("TEST")
end)
Install
BugGrabbler and
BugSack to help you debug your code.