Page 1 of 1

Named patterns demo

Posted: Thu Mar 11, 2021 6:32 am
by Vadi
A little demo package showing how to use named patterns, which allows your triggers to use matches.variablename as a capture instead of matches[#]:

Before:
Selection_077.png
Selection_077.png (54.85 KiB) Viewed 5717 times
After:
Selection_079.png
Selection_079.png (82.41 KiB) Viewed 5717 times
This is particularly handy when you have several patterns and the order of matches changes throughout them, as you can notice is the case here - attacker either comes first or second in the patterns.

Re: Named patterns demo

Posted: Thu Mar 11, 2021 3:24 pm
by demonnic
+1 for the use of f as well =)

Re: Named patterns demo

Posted: Thu Mar 11, 2021 3:42 pm
by Vadi
Indeed, check out the docs for this useful addition by demonnic: https://wiki.mudlet.org/w/Manual:Lua_Functions#f