Jump to content
  • Advertisement
Sign in to follow this  

[Q] Howto register function with variable number of argument ?

This topic is 2711 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi. Recently I got a problem implementing function with variable number of arguments. For example

In Angelscript:
int nA, nB;
float fC;
Print( nA );
Print(nB, fC, 'HaHa' );

In this case, there should be multiple c++ implementations of function "Print". This is not good.

It seems that the "asCALL_GENERIC" and "asIScriptGeneric" are meant to deal with this problem, but I still have problem with registering the function. RegisterGlobalFunction (or RegisterObjectMethod) still reqires a full list of parameter definitions. In one word, asCALL_GENERIC still does not allow runtime argument identification.

The question is if I want to do this trick, which way should I go?

PS: Sorry for my poor English.

Share this post

Link to post
Share on other sites
I haven't implemented support for functions with variable number of arguments yet, it's on my to-do list though. The only way of doing it right now is to register different versions of the function. They could all point to the same generic function though so the function doesn't actually have to be implemented multiple times.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!