techannihilation/TA

Bug in "Selected Units Buttons" widget

playerO1 opened this issue · 0 comments

MOD version: "Tech Annihilation test-11434-f362858" or "Tech Annihilation test-1 11435-c67a451" and may be many time before.
Widget "Selected Units Buttons" (gui_selected_units_buttons.lua)

Floating bug, hard to reproduce.
When select many types of units, I can click on small icon in bottom of screen for select only one, or group of unit. It called "Selected units" "Left click Remove all other unit types". Where I click on first (item 1) - selected it (ok, no bug). When I select against many units then click on second (item 2) it select other item (not item 2, fixed "random" type of units). When I repeat this action 3 or 5 times, select has been work correctly on item 2 and other (no bug). Or I select another units and sometime change by time.
When seelct 4 type of units (Advanced Metal Maker, Nano Turret Level 1, Nano Turret Level 2, Constructor vehicle) - broken first 2 item: click on "Advanced Metal Maker" but selected "Nano Turret Level 2". On ARM T1 units work fine.

May be it problem with wrong usage of LUA's function pairs(). On stackoverflow about pair function:

ipairs() returns index-value pairs and is mostly used for numeric tables... The ordering is deterministic, by numeric magnitude.
pairs() returns key-value pairs and is mostly used for associative tables... the order is unspecified.