Multiple controllers are switching names, guid with lime.ui.Joystick

Which version of OpenFL and Lime are you using? What platform?

Are you using lime.ui.Joystick, lime.ui.Gamepad, or the openfl.ui.GameInput API?

I’m using lime.ui.Joystick hxcpp

I figured it has something to do with a conflict between Joystick.devices :Map<Int, Joystick> that match joystick with ID, and the way I store controller in an Array.
So after trying to change my way of storing joysticks and calling events in my own class without luck, I fixed it by changing devices in Joystick to an Array, it’s not a good solution I know but I just can’t figure another way around this.

To be specific here is a small example of what’s happening when I store joystick in my own class

for (joystick in Joystick.devices) {
var controller:Controller = new Controller(joystick); //my own class
gamePads.push(controller);
}

If in my controller class I call events like joystick.onButtonDown.add (function (button:Int) {
-> It gets the wrong controller.

Oh, I see, so the joystick.id remains constant, but iterating over Joystick.devices can change, since it’s a map?

That’s my guess, first I thought it has something to do with devices being inside the class Joystick itself. But the problem is indeed about iterating from the Map.