No, it will not be working this way...
What you can do, is the following:
Inside of your class-specific files, you create a function to do all the stuff.
Then you can call this class-specific function in your if-statement in the main-file.
The "hunter-file":
lua Code:
local ADDON, ns = ...
ns.hunteropt = function()
-- do hunter stuff here
end
Main-file:
lua Code:
local ADDON, ns = ...
aframes = CreateFrame("Frame", nil, UIParent)
aframes:SetScript("OnEvent", function(self, event, ...) self[event](self, event, ...) end)
aframes:RegisterEvent("PLAYER_ENTERING_WORLD")
local playerClass = FreeUI.playerClass
local f=CreateFrame("Frame")
aframes:SetScript("OnEvent", function(self, event, ...)
local inv = PLAYER_ENTERING_WORLD
if playerClass == "HUNTER" then
ns.hunterop()
end
end)
What is happening is: The hunter-specific function is seperated in an own file, but inserted into the namespace of the addon, so you can use it in your main file.
In the main file, this function is called.
I wouldn't do it that way, but it should work.