BTW, I'm adding dynamic array accessors to XC_GameEngine in a way they'll be able to be coded into UnrealScript with ease.
This test actor works perfectly on my Dev build:
Code: Select all
class TestArray expands Actor;
var() array<int> IntAr;
var() array<string> StrAr;
var() const array<int> ConstTest;
event PostBeginPlay()
{
IntAr[0] = 25;
IntAr[1] = 23;
StrAr[2] = "Test";
Array_Length_Int(IntAr,5);
Array_Length_Int(IntAr,2);
Array_Length_Int(IntAr,-2);
Array_Length_Int(ConstTest,0);
Array_Insert_Int(IntAr, 1, 2);
Array_Insert_Int(ConstTest,0);
Array_Remove_Int(IntAr, 1, 2);
log("Int size: "$Array_Length_Int(IntAr)$", Str size "$Array_Length_Str(StrAr) );
}
native(640) static final function int Array_Length_Int( out array<int> Ar, optional int SetSize);
native(640) static final function int Array_Length_Str( out array<string> Ar, optional int SetSize);
native(641) static final function bool Array_Insert_Int( out array<int> Ar, int Offset, optional int Count );
native(641) static final function bool Array_Insert_Str( out array<string> Ar, int Offset, optional int Count );
native(642) static final function bool Array_Remove_Int( out array<int> Ar, int Offset, optional int Count );
native(642) static final function bool Array_Remove_Str( out array<string> Ar, int Offset, optional int Count );
Now I bet you wonder why are we defining various native functions with an opcode (640), but a non-native package.
== It's like this:
When you define the native function with an opcode number, the compiler won't append the function call to the compiled code but instead the opcode number directly.
This means that if the opcodes 640, 641, 642 happen to be defined in the internal GNatives table, they'll be executed.
XC_GameEngine defines all three opcodes plus the opcode 10 which is the dynamic array accessor (EX_DynArrayElement) which is represented by [].
Since the native code in XC_GameEngine for 640, 641, 642 works independantly of array type, you can define the Array_Insert_blablah function with any type you want and then use it on the same class you're working on
.
Also why 640, 641 and 642?
Unreal 227i definitions, this means the compiled code is cross-compatible with 227i and vice-versa.
Code: Select all
native(640) static final function int Array_Size( out array<template> Ar, optional int SetSize );
native(641) static final function bool Array_Insert( out array<template> Ar, int Offset, optional int Count );
native(642) static final function bool Array_Remove( out array<template> Ar, int Offset, optional int Count );