General Helper Library

Help creating logic scripts for Air Manager Instruments

Moderators: russ, Ralph

Post Reply
Message
Author
Roxus
Posts: 58
Joined: Wed Sep 02, 2020 7:30 pm

General Helper Library

#1 Post 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

User avatar
Sling
Posts: 5237
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: General Helper Library

#2 Post 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.

Roxus
Posts: 58
Joined: Wed Sep 02, 2020 7:30 pm

Re: General Helper Library

#3 Post 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

User avatar
Sling
Posts: 5237
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: General Helper Library

#4 Post by Sling »

Ok for local use but as I said no good for sharing instruments.

Tetrachromat
Posts: 236
Joined: Sun Feb 14, 2021 6:55 pm

Re: General Helper Library

#5 Post 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

Roxus
Posts: 58
Joined: Wed Sep 02, 2020 7:30 pm

Re: General Helper Library

#6 Post 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.

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: General Helper Library

#7 Post by jph »

I very much doubt it is even on the radar of anyone's priorities. :roll:
Joe. CISSP, MSc.

Post Reply