Quote:
Originally Posted by alexx109
And what about by-reference vars? Arrays are still passed by-ref even as a dynamic argument catched by get_arg?
And about int vars as ref, in "normal" function headers we use & to flag them as passed-by-ref...
I guess it is through set_string, set_array and set_param_byref, am I correct?
|
No, those functions are used in dynamic natives.
Here is an example for an array in dynamic arguments:
Code:
foo( )
{
new iArray[ 32 ];
// pretend the array has values
EmptyArray( iArray, sizeof( iArray ) );
}
bar( )
{
new iValue = 3;
GetValue( iValue );
// iValue = 5 now
}
// EmptyArray( array[], const size )
EmptyArray( ... )
{
new size = getarg( 1 );
for( new i = 0; i < size; i++ )
{
setarg( 0, i, 0 );
// setarg( arg, array_index, value )
// same as doing:
array[ i ] = 0;
}
}
// GetValue( &value )
GetValue( ... )
{
setarg( 0, _, 5 );
}
I'm not sure about the byref integer, but the array should work.
__________________