Quantcast
concatenate field error but don't know why - WoWInterface
Thread Tools Display Modes
08-20-11, 04:52 AM   #1
Xeonkryptos
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jul 2011
Posts: 11
concatenate field error but don't know why

i get the error: attempt to concatenate field (a nil value) but in other parts of my addon it works perfectly...

i initialized my global variable:
Code:
ExecuteSoundTable = {playerDied = "laugh", unitDied = "fatality", executeTime = "finish him", havePost = "hallo post" };
there i don't get any error. in other parts i don't get an error, too.

Code:
elseif (event == "COMBAT_LOG_EVENT_UNFILTERED") then
        local _, subevent,_,_,_,_,_, destguid = ...;
        if (subevent == "UNIT_DIED" and destguid == guid) then
            PlaySoundFile("Interface\\AddOns\\ExecuteSounds\\sounds\\"..ExecuteSoundTable.unitDied..".mp3");
        end
but only here and i don't know why, because the sound file exists and can be played but not within the global variable -.-

Code:
elseif (event == "UPDATE_PENDING_MAIL" and HasNewMail() ~= nil) then
        PlaySoundFile("Interface\\AddOns\\ExecuteSounds\\sounds\\"..ExecuteSoundTable.havePost..".mp3");
    end
i hope you can help me with my concatenate field error... i do the same like in other parts but it doesn't want to work :/

if something i wrote is unclear please ask i will try to make it clearer

Last edited by Xeonkryptos : 08-20-11 at 04:56 AM.
  Reply With Quote
08-20-11, 10:06 AM   #2
Ketho
A Molten Giant
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 928
Originally Posted by Xeonkryptos View Post
Code:
ExecuteSoundTable = {playerDied = "laugh", unitDied = "fatality", executeTime = "finish him", havePost = "hallo post" };
Shouldn't it be something like this?
Code:
ExecuteSoundTable = {
	["playerDied"] = "laugh",
	["unitDied"] = "fatality",
	["executeTime"] = "finish him",
	["havePost"] = "hallo post",
}
btw why does it have to a global?
  Reply With Quote
08-20-11, 11:25 AM   #3
Xeonkryptos
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jul 2011
Posts: 11
i tried both possibilities with tables. your code post was the first try to do it and it works but only the havePost variable in the table couldn't be read...

it is a global variable because it should play sounds, not only the defaults one. my thought was that the player can self choose his own sounds if he/she doesn't like the defaults.

and i have a problem with the last variable... ExecuteSoundTable["havePost"] can't be read out... i don't know why because all except the last variable can.

Last edited by Xeonkryptos : 08-20-11 at 11:28 AM.
  Reply With Quote
08-20-11, 12:06 PM   #4
Ailae
A Rage Talon Dragon Guard
 
Ailae's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 318
You've made sure the variable is initialized before the event-handler?

I guess it would help if you posted your code in its entirety, via pastebin.com or similar.
__________________
Oh, the simulated horror!
  Reply With Quote
08-20-11, 12:17 PM   #5
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,698
Post the whole code and the whole error message (especially which line it errored on helps)
  Reply With Quote
08-20-11, 12:18 PM   #6
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,698
Also don't do 'HasNewMail() ~= nil', just 'HasNewMail()' works
  Reply With Quote
08-20-11, 01:15 PM   #7
Xeonkryptos
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jul 2011
Posts: 11
it is initialized because i can read out the other parts...

hier my whole code: http://pastebin.com/hUN9ZXjm
  Reply With Quote
08-20-11, 01:29 PM   #8
Ailae
A Rage Talon Dragon Guard
 
Ailae's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 318
A quick lock at the code doesn't reveal anything out of the ordinary. I took the liberty to download the released version of your addon and noticed that you use ExecuteSoundTable as your SavedVariables table as well.

This leads me to think that there's a conflict with what's in your ExecuteSoundTable since the savedvars table will be loaded after you have declared the table in your code.
__________________
Oh, the simulated horror!
  Reply With Quote
08-20-11, 02:48 PM   #9
Xeonkryptos
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jul 2011
Posts: 11
it is possible that i can solve that with a local variable after loading of the global variable?
  Reply With Quote
08-20-11, 02:52 PM   #10
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,698
Change the name of either the savedvariable or the table, using the same name on those two (local variable or not) will make a conflict no matter what
  Reply With Quote
08-20-11, 08:55 PM   #11
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Ketho View Post
Shouldn't it be something like this?
Code:
ExecuteSoundTable = {
	["playerDied"] = "laugh",
	["unitDied"] = "fatality",
	["executeTime"] = "finish him",
	["havePost"] = "hallo post",
}
You only need to bracket/quote table keys if they contain "special" characters like spaces or periods that wouldn't be valid in, say, a variable name. playerDied does not need to be bracketed and quoted as a table key, though if you prefer to always bracket/quote your table keys for style reasons, it won't break anything if you do.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » concatenate field error but don't know why

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