• Advertisement
Sign in to follow this  

Debugging scripts - type id is asTYPEID_OBJHANDLE.

This topic is 2418 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

[font="arial, sans-serif"][size="2"]Hi[/size][/font][font="arial, sans-serif"] [/font][font="arial, sans-serif"][size="2"]everyone[/size][/font][font="arial, sans-serif"][size="2"]![/size][/font]
[font="arial, sans-serif"][size="2"]I'm[/size][size=2] [/size][/font][font="arial, sans-serif"][size="2"]doing[/size][/font][font="arial, sans-serif"] [/font][font="arial, sans-serif"][size="2"]a debugger[/size][/font][font="arial, sans-serif"] [/font][font="arial, sans-serif"][size="2"]scripts[/size][/font][font="arial, sans-serif"][size="2"], and[/size][/font][font="arial, sans-serif"] [/font][font="arial, sans-serif"][size="2"]I have a question[/size][/font][font="arial, sans-serif"] [/font][font="arial, sans-serif"][size="2"]- how to[/size][/font][font="arial, sans-serif"] [/font][font="arial, sans-serif"][size="2"]work[/size][/font][font="arial, sans-serif"] [/font][font="arial, sans-serif"][size="2"]with [/size][/font][font="arial, sans-serif"][size="2"][b]asTYPEID_OBJHANDLE [/b][/size][/font][font="arial, sans-serif"][size="2"]?[/size][/font]

[font="arial, sans-serif"][size="2"]how do you know[/size][/font][font="arial, sans-serif"] [/font][font="arial, sans-serif"][size="2"]what[/size][/font][font="arial, sans-serif"] [/font][font="arial, sans-serif"][size="2"]it is![/size][/font][font="arial, sans-serif"] [/font][font="arial, sans-serif"][size="2"]=[/size][/font][font="arial, sans-serif"] [/font][font="arial, sans-serif"][size="2"][b]null[/b][/size][/font]

[font="arial, sans-serif"][size="2"]and how[/size][/font][font="arial, sans-serif"] [/font][font="arial, sans-serif"][size="2"]to get[/size][/font][font="arial, sans-serif"] [/font][font="arial, sans-serif"][size="3"][b]asIScriptObject [/b](ie,[/size][/font][font="arial, sans-serif"] [/font][font="arial, sans-serif"][size="2"]all[/size][/font][font="arial, sans-serif"] [/font][font="arial, sans-serif"][size="2"]properties[/size][/font][font="arial, sans-serif"] [/font][font="arial, sans-serif"][size="2"]of the object[/size][/font][font="arial, sans-serif"][size="2"])[/size][/font][font="arial, sans-serif"][size="2"]?[/size][/font]

Share this post


Link to post
Share on other sites
Advertisement
[code]
void *ptr = ctx->GetAddressOfVar(n);
int typeId = ctx->GetVarTypeId(n);
asIScriptObject *scriptObj = 0;

if( typeId & asTYPEID_OBJHANDLE )
{
// The variable is an object handle, i.e. a pointer. Get the address to the actual object
ptr = *(void**)ptr;
}

if( typeId & asTYPEID_SCRIPTOBJECT )
{
scriptObj = (asIScriptObject*)ptr;
}

if( scriptObj )
{
for( int p = 0; p < scriptObj->GetPropertyCount(); p++ )
{
void *ptr = scriptObj->GetAddressOfProperty(p);
int typeId = scriptObj->GetPropertyTypeId(p);

// Recursively interpret the property just as is done with the variable above
}
}
[/code]

You may also be interested in having a look at the [url="https://angelscript.svn.sourceforge.net/svnroot/angelscript/trunk/sdk/add_on/debugger/"]CDebugger[/url] add-on that I'm implementing for the next release of AngelScript. It's not done yet, but I've already implemented much of what you're probably doing for your own debugger.

Regards,
Andreas

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement