Jump to content
  • Advertisement
Sign in to follow this  

GetFunctionById returning null

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



I'm trying to get a function by its ID through the GetFunctionById method. If I step into the method everything seems to be in order with the function ID I provide because it hits this line:

return scriptFunctions[funcId];

So my assumption is then (and correct me if I'm wrong) that the function ID is valid and should return a valid asIScriptFunction object?


This isn't the case though, as that line returns a null object even though its within the bounds of the scriptFunctions array.


Is this how it should behave?



Edited by LittleJimmy

Share this post

Link to post
Share on other sites
scriptFunctions is not a compact array, i.e. there can be elements that are empty in the array.

This happens for example after discarding a module, or removing a configuration group.

Rather than keeping function ids for lookup, it is recommended that you keep the pointer to the actual asIScriptFunction interface.

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!