Advertisement

GetFunctionById returning null

Started by December 19, 2015 06:50 AM
0 comments, last by WitchLord 8 years, 11 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

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