Heh, thanks for that, but I use Linux OS, Ubuntu at the moment. I have an XP machine here as well, or I should say my gf does.. he he. Kate is a KDE based text editor, for Linux machines.
I've seen/messed with Studio a little bit, but it's not really something that can do a whole lot for what I'm dealing with, both the lack of knowledge of Lua (rapidly increasing, though) and more importantly the lack of specific knowledge of this addon's code. shrug, I'll get it, someday, I was just hoping to "fix" it before the 3.2 patch. I'd like to be able to actually play a little again lol.
Well. I feel a lot stupider now. I had found the Reference Manual for Lua online, but somehow I missed that Programming link. I'll be reading that as fast as possible, along with the WoW Programming book, when I have the time. Taking care of an autistic 7 year old is damn near a full time job heh.
I'm thinking I'm going to try using Kate editor, the highlighting options are better, and I was messing with it a little today, figured out how to change the backgrounds/fonts colors so I can get away from the blindingly white background/black text standard.
Correct. "lfgonly" is the table reference that is being passed into the filterwordsonly() function. In that function, the "filter" variable would be referring to the same table as "lfgonly".
Since "lfgonly" isn't defined or created in the processlfg() function, it is defined somewhere else in the file, probably as a file-scope variable (in Lua terms, it is an upvalue, i.e a local variable outside the scope of the function). Look around near the top of the file for something like
"local lfgonly"
that is not defined inside a function (it is defined at the file-level), which would create a file-scope variable. All functions in the file after that declaration would then be able to access and modify "lfgonly" directly.
Indeed, there is a table lfgonly above this code section, I was just making sure I understood how this worked.
if not IsInInstance() and (find(Elo.Event,"CHANNEL") [b]orfind[/b](Elo.Event,"CUSTOM") or find(Elo.Event,"YELL")) then
to this:
if not IsInInstance() and (find(Elo.Event,"CHANNEL") [b]or find[/b](Elo.Event,"CUSTOM") or find(Elo.Event,"YELL")) then
Heh, that's how it is in the file, I'm pasting from gedit text editor out of Ubuntu OS using the KDE desktop, for whatever reason it puts a space in between every line when I paste to websites like this. Apparently I was a tad overzealous in my correcting for that and backspaced on a line I didn't need to. For example
When I paste that in the edit box, it's single spaced as it should be but when I click send it filters the code or whatever and "sees" that extra space and posts it as you see it now.
Ok so then in this section
[PHP]local function filterwordsonly(msg,filter)
if msg and filter then
for a,b in p(filter) do
for k,v in p(b) do
msg = gsub(msg,"%f[%a]"..k.."%f[^%a%d|[]",v)
end
end
end
return msg
end
local function processlfg(msg)
if not IsInInstance() and (find(Elo.Event,"CHANNEL") orfind(Elo.Event,"CUSTOM") or find(Elo.Event,"YELL")) then
msg = gsub(msg,"^%A+[nN]eed%f[%A]"," 2@looking 5@for")
msg = filterwordsonly(msg,lfgonly)
local classtotal = 0
local classnum
for k,v in p(Elo.ClassTable) do
msg,classnum = elogsub(msg,"%f[%a]("..k.."['sz]*%f[%A]","86@%1")
classtotal = classtotal + classnum
end[/PHP]
"lfgonly" is the reference, yes? Pardon me if I'm being a bit slow, but I didn't get much sleep last night.
Thank you, that's very helpful information. I guess I just never got this deep into programming before, most of what I've done were very simple one off widget type things. This addon is way beyond anything I've ever attempted.
Ok, well as a variable name for a table, doesn't it have to be defined somewhere what table it's a name for? Or am I yet again not comprehending something?
The variable "filter" is declared in the function declaration. I.e, it is a local variable to the function, and its contents is passed in by the calling function. You did write:
[php]local function filterwordsonly(msg,filter)
end[/php]
right?
Yes, the ORIGINAL author did. Still, in order to be traversed by pairs doesn't there have to be a table defined as "filter"?? Or no?
I'm not sure I understand what you mean. You can shorthand variables like so: pairs(filter or Filter) -- if filter is nil, use Filter, but I've never seen a programming language that allowed one variable to represent multiple values simultaneously.
Yeah, I hadn't either and nothing I've seen about Lua led me to think it was possible, but I'm still learning it so I wanted to make sure. Of course, figuring out where/what's in the "filter" table probably isn't going to help me much getting this code adjusted properly. I'm just not seeing it correctly I guess.
LOL no, no it isn't, but it is where I started my interest in all forms of coding/programming.
EDIT: OK, it's been a few hours and I have been combing the files in an effort to find this "filter" table. I have been unable to find it... I'm about ready to throw in the towel, there's just nothing logical about this situation to me, and this crap is freaking built on logic.
If you don't define the table before passing it to pairs() or any function that takes a table, you'll get the error "table expected got nil".
P.S. PHP was my first language.
This makes my head hurt more then, because there is no table specifically defined as "filter" anywhere in the file the function is from, or any of the other files in the addon, for that matter. Yet it's always worked, so I must be missing something somehow.. sigh.
You can't "shorthand" a table definition, can you? As in there are several tables that contain in the definition the word "filter" or "Filter" in the files, but you can't use "filter" in the pairs() to mean all of them, correct?
Starting to wish I hadn't decided to attempt to perform CPR on this freaking addon, it's rapidly becoming more trouble than it's worth.
local tab = {
["key"] = "value",
["key2"] = "value2",
}
for k,v in pairs(tab) do
print(k,v)
--[[ prints
key value
key2 value2
--]]
end
for bob,doug in pairs(tab) do
print(bob,doug)
--[[ also prints
key value
key2 value2
--]]
end
I knew the names were arbitrary, I just didn't grasp that you would have to change them when nesting calls, heh. This example brings up another question. As you've defined the "tab" table, wouldn't there have to be a table defined "filter" in the addon? or is this something else I'm stupidly missing...
Coming from web languages I'd have thought this wouldn't be this difficult.. Starting to feel like an idiot, lol.
Unfortunately, no. I'm guessing that k,v is key and value, since those are the most used meanings, but as for a,b I'm still no closer to figuring what they mean. I've certainly become well versed in how the links are formatted, just every way I've thought of to adjust the code to account for their strings hasn't worked. *shrug, I'm usually pretty good at dissecting these things but I'll be danged if I just can't see this one.
Finally got some time to work on this again. Found this in the Abbreviations.lua
local function filterwordsonly(msg,filter)
if msg and filter then
for a,b in p(filter) do
for k,v in p(b) do
msg = gsub(msg,"%f[%a]"..k.."%f[^%a%d|[]",v)
end
end
end
return msg
end
P = pairs, by the way.
So this plus
local function safecapture(msg)
return gsub(msg,"%%?"..magicchars,"%%%1")
end
local function unsafecapture(msg)
return gsub(msg,"%%"..magicchars,"%1")
end
from the Eloquence.lua controls the filter linkskip function. My question now is, how can I adjust the first code to account for the Prof/Achieve links, or do I have to add in an elseif, or a whole new section of code? I've been fiddling with it off and on for the last couple weeks when I could spare the time, and nothing that I've tried with my still limited knowledge of Lua has worked, so I put myself at the mercy of the coding elite here :D
I recently assumed authorship of Eloquence-Fan Update. The original author is of course long gone. I'm a total noob when it comes to Lua, but I've always been a quick learner. Since acquiring it I've fixed the XML error it was throwing and updated the event table with the new Chat_msg_Achievement events, fixed the player levelcap/classcolor stuff, and added a bunch of the Northrend abbreviations.
For the next update release, I've cleaned up a few things in the code that were obviously ancient(WoW wise, anyway), like the section about inferring race because certain classes were only available to one faction ;D I also replaced the deprecated table.getn instances with the # operator.
I've now hit a wall. :confused: I've been poring over the Eloquence.lua for the last couple weeks, and for the life of me I simply cannot figure out how he set up the filters to skip links in chat while still decompressing abbreviations and fixing typos, etc.
Ever since the 3.0 patch Elo has been killing Achieve and Profession links. All the other links are still being skipped correctly. While it is certainly possible to bypass this bug using the /elo skipword command, that then makes Elo skip the entire sentence, instead of just skipping the link. Which sort of defeats the purpose of Elo, you know? All I'd like to do is add these links to Elo's .. internal skiplist, for lack of a better term.
I've been hitting up the Lua 5.1 manual and WoWiki and I just don't see where in the code it is. I thought it might have something to do with this Wiki page, seeing as how it mentions a 3.1 update to chat filters.. but all other links in chat still work as intended, so I'm pretty sure that's not involved... If anyone might be willing to give me either a slight nudge in the right direction, or just smack me in the head with a hammer and show me how he did it/how to fix it, I'd be ever so grateful.
Um, I'd post code, but I really am not sure which snippet from the Eloquence.lua definitely controls the function I'm talking about, to be honest :-[ Since I'm guessing that posting 2k+ lines of code would be annoying, I'll just attach my copy of the Eloquence.lua and nicely ask that someone look it over and give me a hand.
0
I've seen/messed with Studio a little bit, but it's not really something that can do a whole lot for what I'm dealing with, both the lack of knowledge of Lua (rapidly increasing, though) and more importantly the lack of specific knowledge of this addon's code. shrug, I'll get it, someday, I was just hoping to "fix" it before the 3.2 patch. I'd like to be able to actually play a little again lol.
0
I'm thinking I'm going to try using Kate editor, the highlighting options are better, and I was messing with it a little today, figured out how to change the backgrounds/fonts colors so I can get away from the blindingly white background/black text standard.
0
Indeed, there is a table lfgonly above this code section, I was just making sure I understood how this worked.
Heh, that's how it is in the file, I'm pasting from gedit text editor out of Ubuntu OS using the KDE desktop, for whatever reason it puts a space in between every line when I paste to websites like this. Apparently I was a tad overzealous in my correcting for that and backspaced on a line I didn't need to. For example
[PHP]local lfgonly = {
{["[sS]trath?"] = "Stratholme"},
{["[mM][cC]"] = "Molten Core"},
{["[bB][mM]"] = "Black Morass"},
{["[sS][pP]"] = "Slave Pens"},
{["[uU][bB]"] = "Underbog"},
{["[bB][tT]"] = "Black Temple"},
{["[sS][hH]"] = "Shattered Halls"},
{["[sS][lL]"] = "Shadow Labyrinth"},
{["[sS]labs*"] = "Shadow Labyrinth"},
{["[aA][cC]"] = "Auchenai Crypts"},
{["[aA][rR][cC]"] = "Arcatraz"},
{["[bB]ot"] = "Botanica"},
{["[mM]ag"] = "Magtheridon's Lair"},
{["[rR]amp[sz]*]"] = "Ramparts"},
{["[sS][mM][aA]"] = "Scarlet Monastery Armory"},
{["[tT][oO][sS]"] = "Test of Skulls"},
{["[lL]([12356789])[mM]"] = "2@looking 5@for %1 more"},
{["[lL][gG]"] = "2@looking 5@for 7@a group"},
{["[lL][mM]"] = "2@looking 5@for more"},
{["[mM][tT]"] = "main tank"},
{["[rR]eg"] = "regular"},
-- {["[lL]ock"] = "Warlock"},
{["[sS]ham"] = "Shaman"},
{["[hH]"] = "heroic"},
{["[cC][cC]"] = "crowd control"},
{["[cC][oO][tT]"] = "Caverns of Time"},
{["[dD]urn"] = "Durnholde"},
{["[kK]ara"] = "Karazhan"},
{["[bB][sS]"] = "blacksmith"},
{["[eE]ng"] = "engineer"},
{["[cC][oO][sS]"] = "Culling of Stratholme"},
{["[aA][%poO]?[eE][rR]*"] = "area%-bombardment"},
{["(%A)[uU][pP](%A)"] = "%1Utgarde Pinnacle%2"},
{["(%A)[oO][kK](%A)"] = "%1Old Kingdom%2"},
}[/PHP]
When I paste that in the edit box, it's single spaced as it should be but when I click send it filters the code or whatever and "sees" that extra space and posts it as you see it now.
0
[PHP]local function filterwordsonly(msg,filter)
if msg and filter then
for a,b in p(filter) do
for k,v in p(b) do
msg = gsub(msg,"%f[%a]"..k.."%f[^%a%d|[]",v)
end
end
end
return msg
end
local function processlfg(msg)
if not IsInInstance() and (find(Elo.Event,"CHANNEL") orfind(Elo.Event,"CUSTOM") or find(Elo.Event,"YELL")) then
msg = gsub(msg,"^%A+[nN]eed%f[%A]"," 2@looking 5@for")
msg = filterwordsonly(msg,lfgonly)
local classtotal = 0
local classnum
for k,v in p(Elo.ClassTable) do
msg,classnum = elogsub(msg,"%f[%a]("..k.."['sz]*%f[%A]","86@%1")
classtotal = classtotal + classnum
end[/PHP]
"lfgonly" is the reference, yes? Pardon me if I'm being a bit slow, but I didn't get much sleep last night.
0
0
0
0
Yes, the ORIGINAL author did. Still, in order to be traversed by pairs doesn't there have to be a table defined as "filter"?? Or no?
0
Well I guess I need to figure out where tf it is heh.
Yeah, I hadn't either and nothing I've seen about Lua led me to think it was possible, but I'm still learning it so I wanted to make sure. Of course, figuring out where/what's in the "filter" table probably isn't going to help me much getting this code adjusted properly. I'm just not seeing it correctly I guess.
LOL no, no it isn't, but it is where I started my interest in all forms of coding/programming.
EDIT: OK, it's been a few hours and I have been combing the files in an effort to find this "filter" table. I have been unable to find it... I'm about ready to throw in the towel, there's just nothing logical about this situation to me, and this crap is freaking built on logic.
0
This makes my head hurt more then, because there is no table specifically defined as "filter" anywhere in the file the function is from, or any of the other files in the addon, for that matter. Yet it's always worked, so I must be missing something somehow.. sigh.
You can't "shorthand" a table definition, can you? As in there are several tables that contain in the definition the word "filter" or "Filter" in the files, but you can't use "filter" in the pairs() to mean all of them, correct?
Starting to wish I hadn't decided to attempt to perform CPR on this freaking addon, it's rapidly becoming more trouble than it's worth.
HTML, heh.
0
.... /facepalmself.
I knew the names were arbitrary, I just didn't grasp that you would have to change them when nesting calls, heh. This example brings up another question. As you've defined the "tab" table, wouldn't there have to be a table defined "filter" in the addon? or is this something else I'm stupidly missing...
Coming from web languages I'd have thought this wouldn't be this difficult.. Starting to feel like an idiot, lol.
0
0
P = pairs, by the way.
So this plus
from the Eloquence.lua controls the filter linkskip function. My question now is, how can I adjust the first code to account for the Prof/Achieve links, or do I have to add in an elseif, or a whole new section of code? I've been fiddling with it off and on for the last couple weeks when I could spare the time, and nothing that I've tried with my still limited knowledge of Lua has worked, so I put myself at the mercy of the coding elite here :D
0
0
For the next update release, I've cleaned up a few things in the code that were obviously ancient(WoW wise, anyway), like the section about inferring race because certain classes were only available to one faction ;D I also replaced the deprecated table.getn instances with the # operator.
I've now hit a wall. :confused: I've been poring over the Eloquence.lua for the last couple weeks, and for the life of me I simply cannot figure out how he set up the filters to skip links in chat while still decompressing abbreviations and fixing typos, etc.
Ever since the 3.0 patch Elo has been killing Achieve and Profession links. All the other links are still being skipped correctly. While it is certainly possible to bypass this bug using the /elo skipword command, that then makes Elo skip the entire sentence, instead of just skipping the link. Which sort of defeats the purpose of Elo, you know? All I'd like to do is add these links to Elo's .. internal skiplist, for lack of a better term.
I've been hitting up the Lua 5.1 manual and WoWiki and I just don't see where in the code it is. I thought it might have something to do with this Wiki page, seeing as how it mentions a 3.1 update to chat filters.. but all other links in chat still work as intended, so I'm pretty sure that's not involved... If anyone might be willing to give me either a slight nudge in the right direction, or just smack me in the head with a hammer and show me how he did it/how to fix it, I'd be ever so grateful.
Um, I'd post code, but I really am not sure which snippet from the Eloquence.lua definitely controls the function I'm talking about, to be honest :-[ Since I'm guessing that posting 2k+ lines of code would be annoying, I'll just attach my copy of the Eloquence.lua and nicely ask that someone look it over and give me a hand.