Lua code as functions or lambdas support for tempTriggers

Post Reply
User avatar
Vadi
Posts: 4643
Joined: Sat Mar 14, 2009 3:13 pm

Lua code as functions or lambdas support for tempTriggers

Post by Vadi » Sat Sep 30, 2017 12:28 pm

I've added support for having a function in all of the temp*Trigger functions (tempTrigger(), tempColorTrigger(), tempLineTrigger(), tempComplexRegexTrigger(), tempRegexTrigger(), tempBeginOfLineTrigger(), and tempExactMatchTrigger()) as well as raised their error messages up to standard.

If you're keen, try out a preview of it to help us test! Download for macOS, Linux, or Windows.

An example of a function you can now do is:
Code: [show] | [select all] lua
mytriggerID = tempExactMatchTrigger("You have recovered balance on all limbs.", function()
  echo("We matched!")
end)
The nice thing about this is that you can capture local variables or run private functions without having to expose them globally.

Jor'Mox
Posts: 1093
Joined: Wed Apr 03, 2013 2:19 am

Re: Lua code as functions or lambdas support for tempTriggers

Post by Jor'Mox » Sat Sep 30, 2017 10:47 pm

If you wanted to use an already created function, it would look like this, right?
id = tempTrigger("stuff", my_function)

User avatar
Vadi
Posts: 4643
Joined: Sat Mar 14, 2009 3:13 pm

Re: Lua code as functions or lambdas support for tempTriggers

Post by Vadi » Sun Oct 01, 2017 1:14 am

Yup

User avatar
Vadi
Posts: 4643
Joined: Sat Mar 14, 2009 3:13 pm

Re: Lua code as functions or lambdas support for tempTriggers

Post by Vadi » Sun Oct 08, 2017 8:18 am

Have you had any luck trying this out?

User avatar
Vadi
Posts: 4643
Joined: Sat Mar 14, 2009 3:13 pm

Re: Lua code as functions or lambdas support for tempTriggers

Post by Vadi » Tue Oct 10, 2017 8:56 am


Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests