Hello,
EnScript::SetClassVar function should be able to put an element in an array, Or currently, it's not working correctly.
This could be used with the new json api, when you parse array.
Hello,
EnScript::SetClassVar function should be able to put an element in an array, Or currently, it's not working correctly.
This could be used with the new json api, when you parse array.
The class used:
class TestClassArray { autoptr TIntArray m_TestArray = new TIntArray; }
The code used to see if it's working :
TestClassArray testArray = new TestClassArray; GetGame().GetMission().OnEvent( ChatMessageEventTypeID, new ChatMessageEventParams( CCDirect, "", "testArray.m_TestArray.Count() : " + testArray.m_TestArray.Count(), "" ) ); bool success = EnScript.SetClassVar(testArray, "m_TestArray", 0, 40); GetGame().GetMission().OnEvent( ChatMessageEventTypeID, new ChatMessageEventParams( CCDirect, "", "success : " + success, "" ) ); bool success2 = EnScript.SetClassVar(testArray, "m_TestArray", 1, 60); GetGame().GetMission().OnEvent( ChatMessageEventTypeID, new ChatMessageEventParams( CCDirect, "", "success2 : " + success2, "" ) ); GetGame().GetMission().OnEvent( ChatMessageEventTypeID, new ChatMessageEventParams( CCDirect, "", "testArray.m_TestArray.Count() : " + testArray.m_TestArray.Count(), "" ) );
This is actually what is printing, it should print success: true for the two success and have a higher count in the array after that.
Hello NiiRoZz.
SetClassVar API for arrays is for static ones, not dynamic
for dynamic arrays, you need to get it using GetClassVar and then use Insert.
Regards,
Geez