Hello all, I wanted to get the opinion of the community before reporting this as a bug with MV.
Take this sample plugin below:
Consider what happens if we try to parse this structure, this is the result:
My assertion:
If a plugin parameter is defined as a number/boolean in a structure, it should be stringified as a number/boolean. When we parse the structure, it should be in the correct format.
Can some of the JS savvy members validate or rebuke my assertion? Also, feel free to correct me on any terminology.
Take this sample plugin below:
Code:
/*:
* @plugindesc Shows a bug with plugin parameters?
* @param My Structure
* @type struct<Sample>
*/
/*~struct~Sample:
* @param name
* @type text
* @default "foo"
*
* @param value
* @type number
* @default 1
*
* @param enabled
* @type boolean
* @default true
*/
Consider what happens if we try to parse this structure, this is the result:
Code:
var params = PluginManager.parameters("SamplePlugin");
var myStruct = JSON.parse(params["My Structure"]);
console.log(myStruct.value); // Returns "1" rather than 1
console.log(myStruct.enabled); // Returns "true" rather than true
// Compare side by side to see that it incorrectly stringified the structure
console.log(params["My Structure"]);
console.log(JSON.stringify({"name":"foo","value":1,"enabled":true}));
My assertion:
If a plugin parameter is defined as a number/boolean in a structure, it should be stringified as a number/boolean. When we parse the structure, it should be in the correct format.
Can some of the JS savvy members validate or rebuke my assertion? Also, feel free to correct me on any terminology.