Thread Tools Display Modes
Prev Previous Post   Next Post Next
10/14/23, 02:29 PM   #1
sinnereso
AddOn Author - Click to view addons
Join Date: Oct 2022
Posts: 247
Question string.find or string.sub question

Ive been messing with thew new ingame pvp kill feed which i love but I wanted to refine ot to a mmore personal level to not spam out my chat So ive added it to my addon but have been having ocasional popup error which I haven't found the exact cause of.

The new EVENT_PVP_KILL_FEED_DEATH is perfect for my need but has some issues. it fires twice for every kill/death so ive had to make a switch to not display same data twice which was easy enough but now I have a rare popup error "expected integer, got nil" on this line:

Code:
victomCharacterName = victomCharacterName:sub(victomCharacterName:find("^%w+%s*"))
ive been trying different ways to basically strip off the ^M and ^F off the character names to display them in chat. ive tried:

Code:
"^%w+%s*"
"^%w+(%s%w+)"
"^%w+%s*%w*%s*%w*%s*%w*%s*%w*"
its random and works fine 99% of the time. I cant tell if its just too many events too fast issue or something in my code. any ideas?

error example:
Code:
bad argument #2 to 'string.sub' (integer expected, got nil)
stack traceback:
[C]: in function 'string.sub'
user:/AddOns/RidinDirty/RidinDirty.lua:1626: in function 'RidinDirty.KillFeedAudio'
|caaaaaa<Locals> eventCode = 131386, killLocation = "Chalman Keep", killerDisplayName = "@sinnereso", killerCharacterName = "Michael Cullen^Mx", killerAlliance = 2, killerRank = 50, victomDisplayName = "@Irishpierre", victomCharacterName = "Imize^Mx", victomAlliance = 1, victomRank = 16 </Locals>|r
line1626 is the 1st code example:
Code:
victomCharacterName = victomCharacterName:sub(victomCharacterName:find("^%w+%s*"))

Last edited by sinnereso : 10/14/23 at 02:46 PM.
  Reply With Quote
 

ESOUI » Developer Discussions » General Authoring Discussion » string.find or string.sub question


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