class Test {
public static function main() {
var a = func();
var b = ['a', 'b', 'c'];
a.insert(1, 'x');
b.insert(1, 'x');
trace(a);
}
public static function func(): Dynamic {
return new Array<String>();
}
}
compiles to:
(function () { "use strict";
var Test = function() { };
Test.main = function() {
var a = Test.func();
var b = ["a","b","c"];
a.insert(1,"x");
b.splice(1,0,"x");
console.log(a);
};
Test.func = function() {
return new Array();
};
Test.main();
})();
Which is just wrong. Looks like a Haxe issue, maybe?
I would recommend that either someone look at (perhaps?) a macro-based solution to return different known types from “getGameAttribute” so it types properly, or, just type it yourself like this:
var states:Array<Int> = Engine.engine.getGameAttribute ("Level States");
states.insert (0, 1);