problem with temptriggers and excluding

Post Reply
archit
Posts: 2
Joined: Sat Mar 03, 2012 2:45 pm

problem with temptriggers and excluding

Post by archit »

Hello everyone,

I am trying to make a temp trigger that matches on a target, however at the same time it must exclude any lines that contain another word within them.

I have tried:
tempTrigger(target,[[if not string.match(matches[1], "exclude_word") then go_to_function() end]])

This is not working though either due to a syntax error, or I am going about it wrong. Any help would be appreciated.

Iocun
Posts: 174
Joined: Wed Dec 02, 2009 1:45 am

Re: problem with temptriggers and excluding

Post by Iocun »

If it was a syntax error, it would show up in your error view. Does it?

Anyways, the problem here is this: matches[1] is not the whole line your temp trigger matches on, but simply the part matched by the trigger pattern, in this case: target. So the string.match() you have there would only actually match if your target was your exclude_word. What you probably want is:

tempTrigger(target,[[if not string.match(line, "exclude_word") then go_to_function() end]])

archit
Posts: 2
Joined: Sat Mar 03, 2012 2:45 pm

Re: problem with temptriggers and excluding

Post by archit »

Thank you that fixed it all, very much appreciated Iocun!

Post Reply