Logic Machine Forum
Global static lookup table - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Global static lookup table (/showthread.php?tid=2403)



Global static lookup table - mjaanes - 29.12.2019

I need to create a static lookup table, mapping elements of the group addresses to specific rooms in the building. The table is fixed (i.e. will not be changed during run-time - only used for lookup). Number of GAs is approximately 100 and number of rooms is approximately 30 (to give you a feeling of size - i.e. not too big). Approximately 10 scripts will need to use the table (each one running approximately every 5-10 minutes)

If I understand LM correctly, I can not initialize some global variable in the LM that every script can read from (which would clearly have been efficient).

Assuming this is correct, from a performance point-of-view: What is the best way to create this lookup table to be used by multiple scripts?
a) Via storage.set/get (one script could use storage.set during initial start-up of LM and then each script does a storage.get as part of initial housekeeping)
b) Initializing a new table inside the code of each script (i.e. build the table run-time - most likely via a common function called from each of the scripts)
c) Other ways?

Thanks in advance

WISH ALL USERS A HAPPY NEW YEAR


RE: Global static lookup table - admin - 29.12.2019

You can create a user library and include it in every script that needs it.