WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   inputString/string.gsub Help Required (https://www.wowinterface.com/forums/showthread.php?t=15036)

Tornik 02-23-08 02:13 AM

inputString/string.gsub Help Required
 
I'm trying to re-work the Pirate Speak mod it to use internally in my guild - we're rolling up a small alt-guild made up of Orcs, and I'm trying to re-write your mod so that we all talk like Orks from Games Workshop's Warhammer 40,000.

Anyhow, most of the code is straight-forward, which is good as my Lua knowledge is hardly in-depth, the only real problem I'm having is when I'm trying to get the mod to change words that share certain sequences of letters. For example, "his" and "this" tend to get mixed up, as do "the" and "their".

I notice in the code use various symbols like ^, [a], $, are used to prevent the same thing, but I can't quite get it to work, and I was hoping there was a way around this. Can anyone help me out, assuming it's straightforward, or maybe point me towards a resource online I could use? I've tried going through the Lua 5.1 manual online, but as I don't quite know how to correctly phrase what I'm looking for, I'm not getting far.

Shirik 02-23-08 04:13 AM

^ matches the beginning of a string. That is, "^his" will match "his watch" but not "this watch"

$ matches the end of a string. That is, "file$" will match "my file" but not "my files".

Look in PIL for the pattern matching tutorial. PIL can be found at http://www.lua.org/pil and is a bit of an easier read than the manual.

mulesh 02-23-08 06:31 AM

Some links for you:

wowwiki.com's HowTo: Use Pattern Matching
lua-users.org's Patterns Tutorial

Fin 02-23-08 07:27 AM

Quote:

Originally Posted by mulesh (Post 83959)
Some links for you:

wowwiki.com's HowTo: Use Pattern Matching
lua-users.org's Patterns Tutorial

Also, for reference:

- http://pgl.yoyo.org/luai/i/patterns


All times are GMT -6. The time now is 03:21 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI