View Full Version : SelItems wrong order!?

09-02-2007, 08:45 AM
Is it really the case that the array selItems that an LWInterfaceInfo returns is in the wrong order, ie backwards (user first selected item is last in this array)!? Sorry, I just have to check, because it just seems so unbelievable.

What would be the reason for this? Of course at times it could be useful, but it will always be unintuitive.

09-02-2007, 10:21 AM
Seems to be the case, I lscript and the .getSelect always comes out backwards, possibly because it might be stack based, ie first in-last out...

09-02-2007, 10:30 AM
Thanks Dodgy, I had forgotten about that.

It's just so uncomfortable. In the sdk it's a NULL terminated array, but half the benefit of that is lost when you want to process the items in the right order (how the user selected them). I have to count the array manually and use a for-loop instead of just a while-loop (checking for that NULL entry). I wish they would've thought things through better. I doubt the reverse order benefits the majority of scripts/plugins.

Sorry, I'm just bitching because that's all I can do.

09-03-2007, 12:01 AM
Is the order actually defined anywhere?


09-03-2007, 03:12 AM
Is that a smartass remark or just a question?

In any case, no, I don't think any of the docs (lscript or sdk) state that the selItems and getSelect() points to or returns an array of itemids in reverse order (in relation to how the user selected them).

09-03-2007, 06:14 PM
Sorry, that was a genuine question. I haven't come across any documentation stating that the selection is given in any particular order, but sometimes someone knows of some obscure corner of the SDK docs which mentions it.