• Create Account

We're offering banner ads on our site from just \$5!

### #Actualbrumi

Posted 19 September 2013 - 07:10 AM

Hi,

I'm writing a debugger for my project using AngelScript 2.27.1. I've registered a callback and able to extract the variables. I have a nice display showing the variables. For references I'd like to write if it is null or not.

for ( int varIx = 0; varIx < context->GetVarCount( level ); varIx++ )
watch->Show( context->GetVarName( varIx, level )
, context->GetVarTypeId( varIx, level )
, context->GetAddressOfVar( varIx, level ) );


This way I enumerate the variables. In Show, I get the object type:

asIObjectType* objType = ScriptEngine::Instance().GetAsEngine()->GetObjectTypeById( typeId );


And then I have a TODO now

if ( objType->GetFlags() & asOBJ_REF )
{
const asIScriptObject* object = (const asIScriptObject*)address;
bool isValidRef = true; // TODO

item->setText( 2, isValidRef ? "valid ref" : "null ref" );
}


I can cast the address of the property to an asIScriptObject, but I can't still determine if it is null reference or not. I've checked if the address pointer is maybe null, but it is not null even for null ref objects.

Is there a way to check if it is a null ref or not?

Thank you.

### #1brumi

Posted 19 September 2013 - 07:09 AM

Hi,

I'm writing a debugger for my project using AngelScript 2.27.1. I've registered a callback and able to extract the variables. I have a nice display showing the variables. For references I'd like to write if it is null or not.

for ( int varIx = 0; varIx < context->GetVarCount(); varIx++ )
watch->Show( context->GetVarName( varIx, level )
, context->GetVarTypeId( varIx, level )
, context->GetAddressOfVar( varIx, level ) );


This way I enumerate the variables. In Show, I get the object type:

asIObjectType* objType = ScriptEngine::Instance().GetAsEngine()->GetObjectTypeById( typeId );


And then I have a TODO now

if ( objType->GetFlags() & asOBJ_REF )
{
const asIScriptObject* object = (const asIScriptObject*)address;
bool isValidRef = true; // TODO

item->setText( 2, isValidRef ? "valid ref" : "null ref" );
}


I can cast the address of the property to an asIScriptObject, but I can't still determine if it is null reference or not. I've checked if the address pointer is maybe null, but it is not null even for null ref objects.

Is there a way to check if it is a null ref or not?

Thank you.

PARTNERS