Thread Tools Display Modes
Prev Previous Post   Next Post Next
03-02-15, 04:12 AM   #1
Leapin
A Defias Bandit
Join Date: Mar 2015
Posts: 3
Misplaced arguments?

So I'm working on my first Lua script and I thought I'd make a simple addon without any XML and without the need of extra frames and stuff, either way, what I am trying to do is whenever someone joins the guild, it will announce in gchat "Welcome name", however, for some reason, the "msg" argument seem to be gone from the function. The event says the args are message, sender, language, channel, target etc etc, but when I try to call the first argument, instead of message, it's sender.

Code:
local gAuto = CreateFrame("Frame")

gAuto:RegisterEvent("CHAT_MSG_GUILD")
gAuto:SetScript("OnEvent", function(self, event, ...)
 self[event](...)
end)

	function gAuto:CHAT_MSG_GUILD(msg, sender, ...) -- msg = senderName instead of message, and sender = language instead of sender name?
		local str = "has joined the guild"
		name = string.gsub(sender, "-TarrenMill", "")
		name = string.gsub(sender, "-Dentarg", "")
		local welcome = "Välkommen "..name.." :)"
		
		--[[
		if string.find(msg, str) then
				SendChatMessage(welcome, "GUILD")
		else
			return
		end
		--]]
	end
I am really lost, I have no idea what I am doing wrong, any help is appreciated
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Misplaced arguments?


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off