I have the following code:
main.cpp
cstring.h
cstring.cpp
When I run the following script:
int scriptmain( int argc )
{
cstring s = "test";
print( s );
return argc;
}
I get the expected output:
CONSTRUCT
FACTORY( 0x259ed00 'test' )
COPY( 0x259ed00 )
DESTRUCT( 0x259ed00 )
CONV( 0x259ed20 'test' )
SCRIPT SAYS (0x259ed20):
test
DESTRUCT( 0x259ed20 )
The script function returned: 0
However, if I change the script to look like this:
int scriptmain( int argc )
{
print( "test" );
return argc;
}
this is the (incorrect) output I get:
FACTORY( 0x982d00 'test' )
CONV( 0x982d00 'test' )
DESTRUCT( 0x982d00 )
SCRIPT SAYS (0x982d00):
The script function returned: 0
Is this a result of an error in my code or is there a deeper problem with the order in which AS calls functions in the second case ? (note how the 'destructor' is called before the call to the printing function)