< Back to IRCAM Forum

Calling separate functions in a lua script from MaxMSP?

Hello !

I would like to know if possible to make calls from MaxMSP to separate functions defined in a mlys.lua script? Fx if I want to re-initialize the initialise() function without re-excecuting the update() function. A bang to the mlys.lua controller will recall/reinit both.

A mlys controller can have @update as -1, meaning it will only update when called from MaxMSP. Could that feature somehow be applied to make MaxMSP call a separate function in the lua script?

Best Hans Peter

Hi there!

Some observations to continue this discussion.

The expression controller has a “set" message that allow you to force the input values at any movement you want, even if the expression controller itself is updating a samplerate.

This is very handy for functions that requires carefull controll of initial values, while other values are being calculated continuously.

In the lua controller one has the “initialise()” function much for the same purpose, except you can’t recall it or reinitialise it without reinitialising the whole script.

My question is thus if something similar to the “set” message of the expression controller is possible in the lua controller environment? Specifically addressing certain internal variables.

Another question much along the same lines is that the expression controller allows you to access the output values directly in the script using a “out(channel)” command.

Again this is super necessary for functions which require one or two samples delays as many filter operations and differential functions do. In the lua environment you may of course define another set of local variables to mirror the output values. However it would be vary handy is the was something more direct like fx a “modalys.current(channel)” command? Does it exist?

Any hint or clarifications on these issues are most wellcome.

Best Hans Peter