Reloading a script

(ffx) #1

Is there a way to reload a script via a renoise method? In some situations like saving configuration it would make things more easy imo…

(ffx) #2

By “reloading” I actually mean “restarting”… So I guess the answer is no.

(danoise) #3

Closest thing, I guess, is this (from debugging.txt in theXrnxStarterPack):

-- Autoreloading Tool Scripts

When working with Renoise's Scripting Editor, saving a script will
automatically reload the tool that belongs to the file. This way you can simply
change your files and immediately see/test the changes.
When changing any files that are part of the "Libraries" folder, all scripts
will get reloaded.

When working with an external text editor, you can enable the following debug
option somewhere in the tool's main.lua file:

    _AUTO_RELOAD_DEBUG = function()
      -- do tests like showing a dialog, prompts whatever, or simply do nothing

As soon as you save your script outside of Renoise, and then focus Renoise again
(alt-tab to Renoise, for example), your script will instantly get reloaded and
the notifier is called.

If you don't need a notifier to be called each time the script reloads, you
can also simply set _AUTO_RELOAD_DEBUG to true:


(ffx) #4

Thank you! Would it make sense to dive deeper into that? Like is there access to that function which actually reloads the script?

(ffx) #5

I actually meant to use that reloading script not only for development / debugging purposes, but as “real” script action, for instance, I click on “save” of an options dialogue and now could save some lines of code simply by restarting the script by itself :slight_smile: