## Scriptlib refresh?

SecondMan
Site Admin
Posts: 3383
Joined: Thu Jul 31, 2014 5:31 pm
Answers: 2
Location: Vancouver, Canada
Been thanked: 70 times
Contact:

### Scriptlib refresh?

Hello peeps,

Quick question - is there a way to refresh a Scriptlib without restarting Fusion? It's a bit of a drag to work the way I currently am; adjusting some function - restarting Fusion - testing - adjusting - restarting... ad infinitum.

Forgive me if this is in the Scripting manual somewhere, I haven't gone through the whole thing yet. If not possible I can work around it in a couple of ways, but it would be nice...

Thanks!

AndrewHazelden
Fusionator
Posts: 1271
Joined: Fri Apr 03, 2015 3:20 pm
Answers: 1
Location: West Dover, Nova Scotia, Canada
Been thanked: 29 times
Contact:

### Re: Scriptlib refresh?

I'm only an intermediate skill level Lua scripter so please forgive me if I'm wrong.

But couldn't you just copy the part of the bmd.scriptlib code block you are tweaking into your own separate Lua script file then add a "smurfed" namespace prefix to the function you are tweaking like turning "bmd.trimSequence" into "smTrimSequence()"?

In my mind that would be faster to edit during your rapid development phase and then you can merge the working results back into the original scriptlib file later on if you wanted to.

Cheers,
Andrew

SecondMan
Site Admin
Posts: 3383
Joined: Thu Jul 31, 2014 5:31 pm
Answers: 2
Location: Vancouver, Canada
Been thanked: 70 times
Contact:

### Re: Scriptlib refresh?

Thanks Andrew.

Yes, that's my current workaround. Thing is that pretty much every time after I copy the functions into the Scriptlib I then think of something and still want to do some adjustments.

It's not a huge deal, just wondering if it can't be done.

AndrewHazelden
Fusionator
Posts: 1271
Joined: Fri Apr 03, 2015 3:20 pm
Answers: 1
Location: West Dover, Nova Scotia, Canada
Been thanked: 29 times
Contact:

### Re: Scriptlib refresh?

Is the bmd.scriptlib a Lua module? This approach might work (untested):

http://lua-users.org/wiki/ModulesTutorial

When I use the Package Path tip from that Lua tutorial page in Fusion I get back:

Code: Select all

=package.path
./?.lua;@executable_path/share/luajit-2.1.0-beta1/?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;@executable_path/share/lua/5.1/?.lua;@executable_path/share/lua/5.1/?/init.lua

SecondMan
Site Admin
Posts: 3383
Joined: Thu Jul 31, 2014 5:31 pm
Answers: 2
Location: Vancouver, Canada
Been thanked: 70 times
Contact:

### Re: Scriptlib refresh?

Oh interesting - will test this later today and let you know.

Thanks!

SecondMan
Site Admin
Posts: 3383
Joined: Thu Jul 31, 2014 5:31 pm
Answers: 2
Location: Vancouver, Canada
Been thanked: 70 times
Contact:

### Re: Scriptlib refresh?

That didn't quite work. I can clear the scriptllib functions, but not reload it. Consistently, that is.

It's actually weird, I can clear the scriptlib, then when I start a new comp (rather than restart Fusion) the functions in the new scriptlib are there again, and every now and then, and only at the first run, it actually runs the function that has an external update, then it reverts back to the one that way loaded when Fusion was first started.

Lack of time prevents me from doing some more research and getting something I can reproduce, but I'll bookmark this topic for a later date...