Advertisement

Getting function IDs

Started by July 28, 2007 02:15 PM
1 comment, last by SiCrane 17 years, 4 months ago
Before I go and modify the AngelScript source, is there any easy way to get the function ID of a function you've just registered with RegisterGlobalFunction() or an alternate registration method that returns the ID that I've missed? Also, in the implementation of a function that uses the generic calling convention is there a way to get at the function ID of the function being called that I'm missing? Right now the only way I see would be to include the as_generic.h header and cast the interface pointer to the concrete type and go through the sysFunction pointer. Ex:

void my_spiffy_generic_function(asIScriptGeneric *gen) {
  asCGeneric & concrete_generic = static_cast<asCGeneric &>(*gen);
  int id = concrete_generic.sysFunction->id;
}
I haven't implemented any way to get the function id of registered functions, because there hasn't been a reason for me to do so before. It shouldn't be too difficult to allow the application to enumerate registered functions too though.

For the generic function interface I can easily add a method for retrieving the function id. Your idea is correct, this is exactly how the id is stored.

Regards,
Andreas

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

Advertisement
Ok. Sounds like the easiest way would be to modify RegisterGlobalFunction() then. Thanks.

This topic is closed to new replies.

Advertisement