In order to get the value pointer from
a value object, you first need to pass the value to the val_array_ptr function, which will return the
pointer for you. From there, it is simply a case of extracting the values contained therein with the help of
the val_array_size function for the upper bounds limit reference. For example, suppose an array of an
unknown number of integer values were sent to the C/C++ library, the code to extract and print the data
could look something like this:
value* p_arr;
int i;
if ( val_is_array( intArray ) )
{
p_arr = val_array_ptr( intArray );
for ( i = 0; i < val_array_size( intArray ); i++ )
{
if ( val_is_int( p_arr[i] ) )
{
printf( ???item %i = %i???, i, val_int( p_arr[i] ) );
}
else
{
printf( ???non-integer value found at item %i???, i );
}
}
}
else
{
printf( ???value is not an array??? );
}
Neko Arrays, or pointers to value structs, are subjected to the typical rules for pointers to item lists in
C/C++. One of the biggest limitations is that, although you can increase the size of an Array in Neko
exponentially, without requiring any formal re - dimensioning, you are pretty much capped to an initial
limit when using the same Array in the C/C++ layer.
Pages:
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054