Thread Tools Display Modes
Prev Previous Post   Next Post Next
06/28/23, 12:44 AM   #1
sinnereso
AddOn Author - Click to view addons
Join Date: Oct 2022
Posts: 247
Question string.find or string.match question

Hey ive been having some irregularities with one of my teleport functions. Particularly with my blacklist.

I have "Tel Galen" in my blacklist and have trouble teleporting to "Galen". I guess what I'm needing is a way to exactly match not match part of "Tel Galen".

Heres a sort of example of what I'm using to achieve what I have now.

Code:
local _, _, memberZone, _, _, _, _, memberzoneID = GetGuildMemberCharacterInfo(guildId, memberIndex)

if not MyAddon.ZoneBlacklist(memberZone) then
     teleport to blah blah blah
end

function MyAddon.ZoneBlacklist(value)
     local zones = {
     "Tel Galen",
     }
     for _, zoneName in ipairs(zones) do
          if string.match(zoneName, value) then return true end
     end
     return false
end
Whats happening is when someone is in "Galen" and it does the blacklist check its returning true for "Tel Galen" and not performing the teleport. I need some way to ensure "Galen" zone returns false like an exact match start to finish not partial. Any suggestions? Im wondering if just reversing zoneName, value in the string.match to value, zoneName might do the job and look for "Tel Galen" in "Galen".

Last edited by sinnereso : 06/28/23 at 12:49 AM.
  Reply With Quote
 

ESOUI » Developer Discussions » General Authoring Discussion » string.find or string.match 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