forked from Mudlet/Mudlet
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve: add named captures to Aliases (Mudlet#7175)
#### Brief overview of PR changes/additions This has been done by carefully comparing the matching code from the PCRE trigger item. Some variables have been renamed so they match up better. #### Motivation for adding to Mudlet This has been a long-standing but unlisted wish-list item but someone actually raised an issue for it! 😀 Fortunately much of the needed code was already in place, just the bit that injected the named group results into the Lua sub-system was missing (the call to `TLuaInterpreter::setCaptureNameGroups(nameGroups, namePositions)`)! #### Other info (issues closed, discussion etc) It does actually make writing aliases a bit easier because it is easier to construct an alias using `matches.target` say rather than `matches[4]` if `?<target>` has been inserted at the start of the relevant capture group. It also makes extending/modifying an alias easier as there is no need to juggle indexes in the Lua script that uses, say, `matches.target` compared to one that uses `matches[4]`. This should close Mudlet#7171. Signed-off-by: Stephen Lyons <[email protected]>
- Loading branch information
Showing
3 changed files
with
47 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters