MV I can't access the number of the plugin parameter that is a number array

I have a parameter in my plugin that is a number array. But I cannot access the values from it. It seems it returns the full string with the number I have added as a plugin "["64"]".

Spoiler: Code
@param ElementIconNumber * @text Elements Icon's Number * @type number[] * @desc Choose the element's icon from the icon list. The index must match the element's name. var params = PluginManager.parameters("MyWeaknessPlugin"); var elementMine = new Array(params.ElementIconNumber); console.log(params.ElementIconNumber[0]); console.log(elementMine[0]); console.log(Number(elementMine[0])); console.log(Number(params.ElementIconNumber[0])); console.log(elementMine[0].replace([], ' ')); console.log(elementMine[0] + 1); //console.log(eval(elementMine[0] + 1)); var elementMine2 = []; for (var r = 0; r < params.ElementIconNumber.length; r++) elementMine2.push(params.ElementIconNumber[r]); console.log(elementMine2[0]);

Spoiler: Output
image_2021-12-20_165845.png

Thanks in advance!
didn't you miss a * before param ElementIconNumber?
and how long is the number array? which can be reach with -1
for the last number and another to target the index of the array lengths.
didn't you miss a * before param ElementIconNumber?
and how long is the number array? which can be reach with -1
for the last number and another to target the index of the array lengths.
Oh I didn't miss a * before that param. It just has copied and pasted this way here.
The number array is currently 1 at length. It contains the number 64.
What do you mean by the last part here?
I don't see how we could help you based on what you show. You are showing the console output of two arrays, and you don't show how you initialize either one. That's why the NaN response is expected, because you're trying to cast undefined as a number.

And as for the other, there must be someplace where you set it equal to a string.
I don't see how I am not showing you guys where I initialize the arrays. I have shown you guys. Here it is:

* @param ElementIconNumber * @text Elements Icon's Number * @type number[] * @desc Choose the element's icon from the icon list. The index must match the element's name. var params = PluginManager.parameters("MyWeaknessPlugin"); var elementMine = new Array(params.ElementIconNumber);
That is declaring two variables, but only initializing one of them. See:

Code:
var elementMine = new Array(params.ElementIconNumber);
is declaring an array of length (number of elements) equal to ElementIconNumber, all of which are undefined

As far as your params variable, if you read the documentation for RPG Maker MV under Plugin Specifications, it tells you right there "All parameters will be treated as strings so convert them as necessary."
Hey guys! I have done it now! This is what I did (I've learned this online )

var elementMine3 = JSON.parse(elementMine); console.log(elementMine3[0]); //equals 64

As @ATT_Turan has said, the RMMV parameters are strings so you have to convert them. You have to parse the string into an array.

I will leave this here just in case other people would need this information. I appreciate the help anyways guys, especially @ATT_Turan who gave me the above info about parameters.

Original thread: https://forums.rpgmakerweb.com/threads/i-cant-access-the-number-of-the-plugin-parameter-that-is-a-number-array.143180/