🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

GetFunctionById returning null

Started by
0 comments, last by WitchLord 8 years, 6 months ago

Ahoy!

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?

Thanks

Advertisement
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.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement