I was very tormented native system of work with references! I always use the links to be mistaken! But sometimes mistaken.
Always difficult to know what can make this code:
http://www.everfall....hp?8x2ooxr0acic
class Imp
{
Imp() { val = 9; }
string GetStr() { return "" + val; }
int val;
}
void startGame( string ¶m )
{
Imp im = Imp();
Imp @im2 = Imp();
im2.val = 99;
im2 = im; // Why need copy, why why why ? im2 its Reference!
im.val = 0;
output( "im: " + im.GetStr() );
output( "im2: " + im2.GetStr() );
}[/quote]
I often make a mistake forgetting to write "@" im2 = im
I found this thread: http://www.gamedev.n...etreturntypeid/
and i look in to - https://angelscript....licithandle.cpp And i say: OMG!!!! O! M! G!!!!
Why did I not know about this before? It would have saved me a lot of nerve! I am angry at myself!
But! How to register c++ class ?
r=en->RegisterObjectType( "Scene", 0, asOBJ_REF | asOBJ_NOCOUNT ); assert( r >= 0 );
try this:
r=en->RegisterObjectType( "class@ Scene", 0, asOBJ_REF | asOBJ_NOCOUNT ); assert( r >= 0 );
r=en->RegisterObjectType( "@Scene", 0, asOBJ_REF | asOBJ_NOCOUNT ); assert( r >= 0 );
r=en->RegisterObjectType( "Scene@", 0, asOBJ_REF | asOBJ_NOCOUNT ); assert( r >= 0 );
i can fail, fail, fail.