Jump to content
  • Advertisement
Sign in to follow this  
Solokiller

Funcdefs are not tracked properly by the engine

This topic is 1085 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

It appears that funcdefs are not tracked properly by the engine. Registering a funcdef, and then attempting to retrieve it immediately afterwards results in a null pointer being returned:

const int iTypeId = pEngine->RegisterFuncdef( "void foo()" );

asIScriptFunction* pFunction = pEngine->GetFuncDefFromTypeId( iTypeId );

From what i can tell, the internal type id to object type map isn't updated to include funcdefs.

 

Because of this, IsCompatibleWithTypeId doesn't work either.

Edited by Solokiller

Share this post


Link to post
Share on other sites
Advertisement

asIScriptEngine::RegisterFuncdef does not return a type id, that's why GetFuncdefFromTypeId doesn't find anything. It's unofficial (i.e. not documented and subject to change) but RegisterFuncdef currently returns the internal function id for the funcdef. The GetFunctionById method can be used to retrieve the asIScriptFunction for that id.

 

To get the actual type id for the funcdef you need to use asIScriptEngine::GetTypeIdByDecl.

 

Regards,

Andreas

Share this post


Link to post
Share on other sites

Alright, thanks. I was able to solve my problem by retrieving the funcdef using the previous funcdef count as a starting point, then using GetFuncdefByIndex to get it.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!