Hi everyone,
I’m doing demo on educational project. In that i created two attributes, like i give one example. One attribute is question array and another one is answer array. In this if i give length of the question array is 5. It is possible that the length of the answer array is 5.
I need automatically get the value of answer array length and ask values for the answer array.
if it is possible means i can use this solution for more problems.
Thank you in advance and waiting for your great solution.
What’s the issue? What do you mean by ‘automatically’?
GameController.attributes.add("que",{type:"string", title:"Questions", default:[], array:true, description:"" });
GameController.attributes.add("ans",{type:"string", title:"Answers", default:[], array:true, description:"" });

This is the difference. If i link up the question and answers arrays. if i give questions size 5. Possible to generate answer size is 5. Without hard coding answer array size
You want to ensure that both arrays are always the same size? I’m afraid you can’t do that in attributes.
For something like this, I would use a JSON file instead and load at runtime.