[pycon] AuxArrayTestUDF
Viewer
- scn AuxArrayTestUDF
- array_var aArray
- int iSize
- int iIndex
- int iNum
- string_var sv_Type
- string_var sv_Temp
- short bSkip
- begin Function {bSkip}
- print "== Beginning MultiDimensional AuxVar Test =="
- let aArray := ar_construct "array"
- let aArray[0] := ar_construct "array"
- let aArray[1] := ar_construct "array"
- let aArray[0][1] := 154
- let aArray[0][2] := 30
- let aArray[1][1] := 14
- let aArray[1][2] := 63
- ;--------------------
- if bSkip != 1
- print "== Checking starting array == "
- let iSize := ar_size aArray
- print "Ar Size: " + $iSize
- ar_dump aArray
- let iIndex := -1
- while (iIndex += 1) < iSize
- let sv_Type := TypeOf aArray[iIndex]
- ;---The code below accurately returns code "Array", and ar_dump aArray[iIndex] performs as expected---;
- if eval (sv_Type) == "Array"
- ar_dump aArray[iIndex]
- else
- print "ERROR: The type of content held at Index #" + $iIndex + " is: " + $sv_Type
- print "It should be type Array"
- endif
- loop
- else
- print "== Skipped the dump of the actual array. == "
- endif
- ;------------
- print "== Checking converted array == "
- player.AuxVarSetFromArr "someVarName" aArray
- let aArray := ar_Null
- let aArray := player.AuxiliaryVariableGetAsArray "someVarName"
- ;---------------------
- let iSize := ar_size aArray
- print "Ar Size: " + $iSize
- ar_dump aArray
- let iIndex := -1
- while (iIndex += 1) < iSize
- let sv_Type := TypeOf aArray[iIndex]
- ;---The code below returns an error, since type Number somehow shows up.---;
- if eval (sv_Type) == "Array"
- ar_dump aArray[iIndex]
- else
- print "ERROR: The type of content held at Index #" + $iIndex + " is: " + $sv_Type
- print "It should be type Array"
- endif
- loop
- print "== End Test =="
- sv_destruct sv_Type, sv_Temp
- end
Editor
You can edit this paste and save as new: