Thread Tools Display Modes
Old 06-30-12, 05:22 AM   #1
Coote
A Scalebane Royal Guard
 
Coote's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 422
Have they changed how SendChatMessage works?

Currently on live
Code:
SendChatMessage(msg[random(trash)], "SAY", NIL)
works perfectly fine, but on the beta servers, I'm getting errors.

Code:
Message: Interface\AddOns\AfterKill\AfterKill.lua:29: attempt to index global 'msg' (a nil value)
Time: 06/30/12 06:05:18
Count: 1
Stack: Interface\AddOns\AfterKill\AfterKill.lua:29: in function <Interface\AddOns\AfterKill\AfterKill.lua:27>

That particular line of code is the only one that's throwing errors. I've tested with that line removed, and everything else works perfectly. I've tried looking and seeing what changed, but finding nothing. Undocumented change, or just me being noobier than usual?
__________________

"This is the fifteen-thousandth four hundredth and ninety-eighth occurence".
Coote is offline  
Old 06-30-12, 05:34 AM   #2
Xrystal
nUI User and Supporter
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,024
One thing to do is find out where your msg table is set as it thinks it is null at present

It doesn't look like SendChatMessage function itself has changed.
SendChatMessage(msg, "WHISPER", editBox.languageID, lastTell);
Is an example of what is in the latest beta version of ChatFrame.lua
__________________
Xrystal is offline  
Old 06-30-12, 05:49 AM   #3
Coote
A Scalebane Royal Guard
 
Coote's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 422
Thanks. I fixed it by changing up my table a bit, and the message.

Going from
Code:
local trash = {
	"test 1",
	"test 2",
	"test 3",
}

SendChatMessage(msg[random(trash)], "SAY", NIL)
to
Code:
local trash = {
	[1] = "test 1",
	[2] = "test 2",
	[3] = "test 3",
}

SendChatMessage(trash[random(1,3)], "SAY", NIL)
fixed it up.
__________________

"This is the fifteen-thousandth four hundredth and ninety-eighth occurence".
Coote is offline  
Old 06-30-12, 07:00 AM   #4
Lombra
A Chromatic Dragonspawn
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 171
The table is identical to what you had before, however you're now actually referring to that table and not some other, non existant one. You were also trying to pass the table as an argument to random, rather than its length.

This should work:
Code:
local trash = {
	"test 1",
	"test 2",
	"test 3",
}

SendChatMessage(trash[random(#trash)], "SAY")
(also, no need to explicitly pass nil since it's the last argument)
__________________
Grab your sword and fight the Horde!
Lombra is offline  
Old 06-30-12, 12:21 PM   #5
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 9,522
For future reference, if the function were changed, the error message would say that you were using it incorrectly. (for example "TipTop-2.9.4\\tiptop-2.9.4.lua:409: Usage: GetSpecializationInfo(specIndex[, isInspect[, isPet]]])")

Your error was just saying that the argument you passed to the function was nil and it couldn't do anything with it. This could be from typos, clearing the variable, scope issues, etc.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

Seerah is offline  
 

Go BackWoWInterface » WoD Beta » MoP archived threads » Have they changed how SendChatMessage works?

Thread Tools
Display Modes

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