A Gearswap Academia - Class 3

Language: JP EN DE FR
New Items
2020-03-17
505 users online
Forum » Windower » General » A Gearswap Academia - Class 3
A Gearswap Academia - Class 3
 Asura.Elizabet
Offline
Server: Asura
Game: FFXI
user: Elizabet
Posts: 444
By Asura.Elizabet 2020-01-21 21:36:19
Link | Quote | Reply
 
Node 386
[+]
 Leviathan.Draugo
Offline
Server: Leviathan
Game: FFXI
Posts: 1660
By Leviathan.Draugo 2020-01-22 14:37:10
Link | Quote | Reply
 
Keep em coming! Thank you!
 Sylph.Talym
VIP
Offline
Server: Sylph
Game: FFXI
user: Talym
Posts: 69
By Sylph.Talym 2020-01-22 15:59:26
Link | Quote | Reply
 
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
Server: Asura
Game: FFXI
user: Elizabet
Posts: 444
By Asura.Elizabet 2020-01-22 16:22:23
Link | Quote | Reply
 
Good call Talym! Thanks for the clarification.
Log in to post.