Hi @Lanthade
The implementation of a lookup is not something that DashBoard exposes to the scripting layer. I can confirm for you that there is no guarantee of order in the internal implementation.
There are quite a few other ways to keep track of information in the scripting layer - params or JSON objects are likely a good fit depending on what you are trying to achieve. If you do need to do a lookup, storing something like a "lookup.elementcount" and then iterating over your lookup entries based on what you stored in your element count would be a potential workaround.
A lookup is just a key/value pair of strings - you should be able to fill them with whatever you want as long as you serialize them to a string. If you want the ability to modify your data, parameters are a better choice. If you want temporary data, then ogScript/JSON would be a good fit. A lookup works best with static information you need to access in your panel.
<abs contexttype="opengear">
<meta>
<lookup id="test">
<entry key="mylookup.elementcount">3</entry>
<entry key="mylookup.element.0.name">First</entry>
<entry key="mylookup.element.1.name">Second</entry>
<entry key="mylookup.element.2.name">Third</entry>
</lookup>
<ogscript handles="onload">var count = parseInt(ogscript.getPrivateString('test', 'mylookup.elementcount'));
var str = "Got " + count + " elements:\n";
for (var i = 0; i < count; i++)
{
str += ogscript.getPrivateString('test', 'mylookup.element.' + i + '.name') + "\n";
}
ogscript.rename('output', str);
</ogscript>
</meta>
<label height="271" id="output" left="12" style="txt-align:center;" top="31" width="440"/>
</abs>
Cheers.
James
#DashBoard