Creating an object in this way without an
existing object is merely a means to initialize a new value struct, readying it for the allocation of values
via newly assigned fields:
value myObj = alloc_object( NULL );
Passing an existing object to alloc_object copies all values from the original object to the new object.
Any values containing pointers to data will have the pointer reference copied, not the data the pointer
points to.
Chapter 20: Extending ha X e with C/C++
567
Once you have your new object structure, or perhaps an existing object, you can then assign value
structs to it using the alloc_field function. alloc_field accepts three parameters. The first two are
identical to those required by val_field , while the third is the value struct you wish to assign to
the object:
alloc_field( myObj, val_id( ???newField??? ), myValue );
You can add as many fields to an object as you wish, and are not limited in any way, except to say that
any added fields must be of the value struct type.
Arrays
Like many array types in the C/C++ languages, Neko Arrays are presented in the C/C++ layer as a
pointer to a data type, in this case a value struct, or value* .
Pages:
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053