Organizing code and Include/require external modules

Post topics about HALion scripting.
Post Reply
Kerphelio
New Member
Posts: 21
Joined: Sun Feb 03, 2013 12:18 am
Contact:

Organizing code and Include/require external modules

Post by Kerphelio » Tue Jan 30, 2018 3:02 am

Hi everyone,

I was wondering if there were any thoughts on how to organize code for maximum re-usability especially when thinking about sharing and (not to forget) maintaining functionality across multiple projects.
I know that in principle Halions version of Lua does support the "require" function, which would be exactly what I'm looking for, alas for that I don't see a way to get around relying on actual external lua files that would have to be shipped out to the users system. So I'm wondering if there is a recommended workflow here.
I was thinking if maybe multiple Lua Script objects can be helpful with this, or if maybe the library creator would allow me to "bake" external Lua files into a container that can be protected for deployment, but I've not really found a good answer so far.
Ideally I'd like to work with as many separate external lua files as I want and then have the whole thing compiled into a container when I export the program, but any other suggestions would be welcome.
Cubase 9.5, HALion 6, Wavelab 9
Windows 10 64 Bit,
4 core, 16GB Ram, Steinberg UR 242

misohoza
Member
Posts: 834
Joined: Sun Oct 05, 2014 12:18 am
Contact:

Re: Organizing code and Include/require external modules

Post by misohoza » Tue Jan 30, 2018 12:39 pm

Hi Kerphelio,

I think it depends on how you want to distribute your programs.

If you plan to build vstsound container then it should be fine as the Library Creator should collect and include all external script files that are needed for the programs. Same way it does with samples. You can protect the scripts if you want to.

I have only tried require function briefly and it worked fine. I haven't tried to build a library that would make use of modules yet but I believe they should be also collected by Library Creator as "dependent files".


***Regarding your other thread about debugging, I'd like to know as well.
Win 10 Home, 64 bit, 8 gb ram,
Cubase Pro 9, Wavelab Pro 9, Halion 6, Dorico,
NI Komplete 10 Ultimate, Ozone 7,
UR 44

Kerphelio
New Member
Posts: 21
Joined: Sun Feb 03, 2013 12:18 am
Contact:

Re: Organizing code and Include/require external modules

Post by Kerphelio » Wed Jan 31, 2018 7:45 am

Thanks misohoza,

that sounds like I'll definitely do some little test project with library creator. I can see how it would include lua files referenced by the lua script module, but I'm a little doubtful it would "know" about other files that are tied to the project only by "require" statements - unless it really is sophisticated enough to parse the lua files for them, which of course would be awesome.
Hmm, or I'll just manually drag all the files in, duh. We'll know soon enough... :ugeek:
Cubase 9.5, HALion 6, Wavelab 9
Windows 10 64 Bit,
4 core, 16GB Ram, Steinberg UR 242

Kerphelio
New Member
Posts: 21
Joined: Sun Feb 03, 2013 12:18 am
Contact:

Re: Organizing code and Include/require external modules

Post by Kerphelio » Fri Feb 02, 2018 11:02 am

UPDATE: Yup, that seems to have worked. I created a little test project that called functions from and across multiple .lua files. Then I created a library and manually dragged all the files into the Library Creators "content" field, just like presets. It then automatically creates a "script" folder. Once the container was created, I tested on a different PC and all the scripted functionality seems to be working just as expected. Very nice!
Cubase 9.5, HALion 6, Wavelab 9
Windows 10 64 Bit,
4 core, 16GB Ram, Steinberg UR 242

User avatar
abject39
Member
Posts: 303
Joined: Sat Jan 17, 2015 8:20 pm
Location: Ventura, Ca
Contact:

Re: Organizing code and Include/require external modules

Post by abject39 » Thu Feb 08, 2018 2:52 am

This is a pretty smart idea. When you do this does the parameters created in the external lua files appear in halion to be mapped to the GUI or did you plan to use this in a different way?
My vision is uncompromising: to transcend my clients dreams by mesmerizing their audience with the world's finest audio arrangements and products.

Kerphelio
New Member
Posts: 21
Joined: Sun Feb 03, 2013 12:18 am
Contact:

Re: Organizing code and Include/require external modules

Post by Kerphelio » Wed Feb 14, 2018 5:57 am

Everything, parameters and all, was working as it was before I created a Library.
Cubase 9.5, HALion 6, Wavelab 9
Windows 10 64 Bit,
4 core, 16GB Ram, Steinberg UR 242

Post Reply

Return to “Halion Scripting”

Who is online

Users browsing this forum: No registered users and 1 guest