Array into an array into an object

I am trying to enable an array filled with arrays throught the notebox, but I'm stuck trying to make it work and I don't know where is the problem.

It starts aliasing DataManager.isDatabaseLoaded and add notetags on enemies:

DataManager.processEnemyNotetags = function(group) { var note1 = /<(?:my notetag)>/i; var note2 = /<\/(?:my notetag)>/i; for (var n = 1; n < group.length; n++) { var obj = group[n]; var notedata = obj.note.split(/[\r\n]+/); obj.my_array = []; var esFlag = false; for (var i = 0; i < notedata.length; i++) { var line = notedata; if (line.match(note1)) { esFlag = true; } else if (line.match(note2)) { esFlag = false; } else if (esFlag) { line = line.split(":") if ((line.lenght > 1)&&(line[0] != Nan)&&(line[1] != Nan)) { obj.my_array.push(line); } } } }};So it whould recognice something like:
<my notetag>
1:1
2:5
</my notetag>

Then it checks before combat... :

ICF.myfunc.setup = Game_Enemy.prototype.setup;Game_Enemy.prototype.setup = function(enemyId, x, y) { var result = 0; var ary = $dataEnemies[enemyId]._my_array; if (ary.length == 0) { result = 0; } else if (ICF.Param.myVarAbsolute) { for (i = 0; i < ary.length; i++) { if (ary[0] == $gameVariables.value(ICF.Param.myVar)) { result = ary[1]; break; } } } else { for (i = ary.length - 1; i >= 0; i--) { if (ary[0] <= $gameVariables.value(ICF.Param.myVar)) { result = ary[1]; break; } } } ICF.myfunc.setup(enemyId, x, y);};But it throw errors on ary.length on every variation I make to the plugin.
You spelled length wrong, so it doesn't know what to do.

EDIT:

Just to be clear (and also because I realize that my initial comment may seem harsh), in the code you have that is checked before battles, you have mispelled 'length' as 'lenght'. If you correct it, you shouldn't encounter that issue anymore. 
Thanks. I'll check script to see if it works now. I can't believe how had I mispell this.
Ya you spelled length wrong. Your logic is a bit coupled but that shouldn't affect any thing 🙂
Still not working.

TypeError

Cannot read property 'length' of undefined

 

For some reason it can't retieve the array.
Because you are checking "_my_array", when it's called "my_array" in your first function.
I tried $dataEnemies[enemyId]._my_array; $dataEnemies[enemyId].my_array; $dataEnemies(enemyId)._my_array; and $dataEnemies(enemyId).my_array;

None of these works.

Only the one showed in my function doesn't throw an undefined error.

Original thread: https://forums.rpgmakerweb.com/threads/array-into-an-array-into-an-object.52100/