🎉 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!

struggling to get TypeInfo from inside a template member function

Started by
2 comments, last by Dragonstorm97 1 year, 4 months ago

Hi all ?

I'm wrapping a class that I cannot alter (Unreal Engine's FScriptArray, as TArray<T>) and need a way to get the typeInfo in method calls.

For TArrays created in script, the constructor I registered caches the TypeInfo in a map from FScriptArray* to TypeInfo*. This works fine as I can just query this map for the info I need in the member calls.

The issue is for FScriptArrays that are created in the application and passed to script. The constructor isn't called on them, so I need another way to get the TypeInfo.

Ideally, I could store what I need in some user data from the template callback, but I need a way to access that user data from member functions.

Does anyone have an idea or tips for this?

Advertisement

You can use asGetActiveContext()->GetSystemFunction()->GetObjectType().

Alternatively if you use the generic calling convention to wrap the class method, you can use the asIScriptGeneric::GetFunction()->GetObjectType().

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

@WitchLord Thanks!
I kept playing around and ended up with exactly that ?

I was going to as if I could rely on the systemfunction for it;

it would be nice if the documentation mentioned how to get the current function and the difference between ctx→GetFunction() vs ctx→GetSystemFunction().

I wanted to avoid the generic calling convention for this one, and it's pefrect.

This topic is closed to new replies.

Advertisement