public static object CreateArray(ELEMENT e, xmlScriptObj scrObj, STACKVAL stack) { if (!e.isBLOCK_L()) { return(null); } if (e.GetListCount() == 0) { return(null); } var array = new xmlScriptJS.Array(); for (int i = 0; i < e.GetListCount(); i++) { array.Set(i, xmlScriptFunc.Execute(e.GetListElement(i), scrObj, stack)); } return(array); }
public static bool ExecuteSetVariable(ELEMENT e, object val, xmlScriptObj scrObj, STACKVAL stack) { if (!e.isVARIABLE()) { return(false); } if (e.isVARIABLE_NOTARRAY()) { return(stack.SetVal(e.raw, val)); } if (e.GetListCount() == 1) { var index = xmlScriptArray.GetArrayIndex(e.GetListElement(0), scrObj, stack); //Debug.LogError("index = " + index); var array = stack.GetVal(e.raw); if (array == null) { array = new xmlScriptJS.Array(); } //Debug.LogError("array = " + array); if (xmlScriptGetMethod.ObjectGetType(array) == typeof(xmlScriptJS.Array)) { ((xmlScriptJS.Array)array).Set(index, val); if (!stack.isExist(e.raw)) { stack.SetGlobalVal(e.raw, array); } else { stack.SetVal(e.raw, array); } //Debug.Log("array1 = " + array); //Debug.Log("array2 = " + stack.GetVal(e.raw)); } } else { object[] indexList = new object[e.GetListCount()]; for (int i = 0; i < e.GetListCount(); i++) { indexList[i] = xmlScriptArray.GetArrayIndex(e.GetListElement(i), scrObj, stack); } var array = stack.GetVal(e.raw); if (array == null) { array = new xmlScriptJS.Array(); } if (array != null && xmlScriptGetMethod.ObjectGetType(array) == typeof(xmlScriptJS.Array)) { xmlScriptJS.Array.SetMultidimension(array, indexList, val); if (!stack.isExist(e.raw)) { stack.SetGlobalVal(e.raw, array); } else { stack.SetVal(e.raw, array); } } } return(true); }