Intermediate N00B Questions

#1

In the terminal I can do something like:

  
renoise.song().tracks_observable:add_notifier(function() print("Hello!") end)  
  

But how do I remove it? The only way I know is loading a new song. Is there some sort of flush Lua API that I am not aware of?

#2

Can I share variables between Tools?

How about sharing a variable from TestPad.Lua and a Tool?

Please explain how Tools are partitioned.

1/ Can’t you just do something like
renoise.song().tracks_observable:remove_notifier(function() print(“Hello!”) end) ?

EDIT: I think the question is “can I remove notifier using anonymous functions”. I also wondered this.

2/ Very good question!

  • Don’t use anonymous functions, but global ones, then you can explicitly “remove_notifier” them.
  • Close the terminal, open it again (this recreates the terminal’s interpreter).
  • Delete the thing you are attached to (create new song, delete the track, device and so on).

Each tool (and the terminal, as said above) lives in a separate Lua interpreter.
Globals can not be shared between different interpreters, unless you use sockets or files or other related stuff.

Not in memory, but using the document option, you could share variable values through saved documents and set time-stamps on saved variables (The latter if you need some kind of check mark to figure out if variable values have been changed since the last time you loaded them).