Page 1 of 1

Lua code as functions or lambdas support for tempTriggers

Posted: Sat Sep 30, 2017 12:28 pm
by Vadi
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.

Re: Lua code as functions or lambdas support for tempTriggers

Posted: Sat Sep 30, 2017 10:47 pm
by Jor'Mox
If you wanted to use an already created function, it would look like this, right?
id = tempTrigger("stuff", my_function)

Re: Lua code as functions or lambdas support for tempTriggers

Posted: Sun Oct 01, 2017 1:14 am
by Vadi
Yup

Re: Lua code as functions or lambdas support for tempTriggers

Posted: Sun Oct 08, 2017 8:18 am
by Vadi
Have you had any luck trying this out?

Re: Lua code as functions or lambdas support for tempTriggers

Posted: Tue Oct 10, 2017 8:56 am
by Vadi