A Gearswap Academia - Class 3

Eorzea Time
 
 
 
Langues: JP EN FR DE
users online
Forum » Windower » General » A Gearswap Academia - Class 3
A Gearswap Academia - Class 3
 Asura.Elizabet
Offline
Serveur: Asura
Game: FFXI
user: Elizabet
Posts: 496
By Asura.Elizabet 2020-01-21 21:36:19
Link | Citer | R
 
Node 386
[+]
 Leviathan.Draugo
Offline
Serveur: Leviathan
Game: FFXI
Posts: 2775
By Leviathan.Draugo 2020-01-22 14:37:10
Link | Citer | R
 
Keep em coming! Thank you!
 Sylph.Talym
VIP
Offline
Serveur: Sylph
Game: FFXI
user: Talym
Posts: 70
By Sylph.Talym 2020-01-22 15:59:26
Link | Citer | R
 
In this lesson, the :match() construction is an example of some Lua syntactic sugar (special shortcut syntax) referring to the standard Lua string.match function.

Let's look at this example:
Code
if spell.name:match('Cure') then

This is a shortcut for calling string.match() with two parameters: spell.name, which is indeed a string, and a second string pattern, 'Cure'.

Written out in full Lua syntax, it would look something like this:
Code
if string.match(spell.name, 'Cure') then

You'll see this type of shortcut used all over the place in various Windower Lua things, so it is probably helpful to understand exactly what's happening.
[+]
 Asura.Elizabet
Offline
Serveur: Asura
Game: FFXI
user: Elizabet
Posts: 496
By Asura.Elizabet 2020-01-22 16:22:23
Link | Citer | R
 
Good call Talym! Thanks for the clarification.