Page 1 of 1

General Helper Library

Posted: Tue Jun 15, 2021 10:22 pm
by Roxus
I see the wiki where we can create a lib/ for an instrument.
Is there a place we can create library code for all instruments ?
Personal helper code

Re: General Helper Library

Posted: Wed Jun 16, 2021 1:03 am
by Sling
Hi,

There is a Lua file in the AM directory tree where the current helpers such as var_cap(), var_round() etc are located. I suppose they could be added there but they may get overwritten during an update. I wouldn’t do this.

It’s best to just include the helpers you create in a lib file and include with any instrument that needs to use them. This way if you ever share something it’s all right there and the instrument is guaranteed to work.

Re: General Helper Library

Posted: Wed Jun 16, 2021 2:55 am
by Roxus
if only Windows had *nix symlinking ... holy crap, it turns out they do !?!? I didnt know that !!

In an Administrator console (need elevated priveleges it seems - although there is an Explorer plugin to add the ability) :

mklink <instrumentid>/lib/functions.lua /path/to/helper_functions.lua

I tested it and AM worked as expected

I didnt test zipping it up if sharing an instrument whether Windows Zip will copy the original or create a link entry like *nix

mklink does have a hardlink option tho, which would solve that problem if it works like *nix as well

Re: General Helper Library

Posted: Wed Jun 16, 2021 7:58 am
by Sling
Ok for local use but as I said no good for sharing instruments.

Re: General Helper Library

Posted: Wed Jun 16, 2021 6:48 pm
by Tetrachromat
I personally place my common code into the lua_libs directory in the installation folder. No problems with updating Air Manager so far, but keeping a repository as backup.

There is also a lib directory in each panel. If your instruments are used in the same panel, I would place the common lua library files there. I assume they are loaded as well when the panel gets loaded.

Paul

Re: General Helper Library

Posted: Tue Jun 22, 2021 5:09 pm
by Roxus
I added hardlinks to my libraries yesterday and it zips up fine.
But when I CLONE an Instrument, AM takes a copy of the files in the lib, so they dont get the changes coz they are unique copies.

Re: General Helper Library

Posted: Wed Jun 23, 2021 8:52 am
by jph
I very much doubt it is even on the radar of anyone's priorities. :roll: