module GetFunctionByName namespace

Started by
3 comments, last by WitchLord 4 years, 6 months ago

Hi,

It seems that `asCModule::GetFunctionByName` does not understand namespaces (but `GetFunctionByDecl` does). Instead it requires me to set the module level default namespace.

This has the problem that it doesn't seem thread safe. So I'd like to ask for support in finding a function by name in a namespace.

Sorry if this is already done, I'm using about 5 months old version of AngelScript (I didn't update to check if this was already added because I'm trying to get a version of my project ready for release).

Advertisement

Hi Boost,

You're right. GetFunctionByName doesn't currently understand namespaces, and it is indeed not safe for multithreading to use the separate SetDefaultNamespace call. 

I'll add this to the to-do list for an upcoming release as a priority item.

If this is vital for your project you should be able to temporarily customize the GetFunctionByName implementation to check if the given name includes the scope and if so use engine->FindNameSpace and look for the function in that namespace instead of the default one.

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

Thanks. I've been able to use the find by declaration as an alternative for the few places where I needed this, though that is not optimal as I don't care about the exact function signature.

I've implemented this in revision 2621.

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

This topic is closed to new replies.

Advertisement