Jump to content
  • Advertisement
Sign in to follow this  
Jason Goepel

Register Parameter Names

This topic is 2134 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

I'm am writing an AngelScript Intelli-sense for my application, and it would be really nice if I could set a flag in the engine to have the parameters of functions and methods be remembered and returned with the asIScriptFunction::GetDeclaration function.  So, if I call:

engine->RegisterObjectMethod("Matrix", "void SetSize(int nRows, int nCols)",
    asMETHODPR(Matrix, SetSize, (int,int), void), asCALL_THISCALL);

Then making the following call on a pointer to that function:


 would return the following string:

"void Matrix::SetSize(int nRows, int nCols)"

Anyway, that would be very convenient for me.  I think the only way for me to presently get this functionality would be to save the declaration string I use in the function's UserData and access it instead of calling GetDeclaration, correct?




Share this post

Link to post
Share on other sites

Yes, AngelScript doesn't store the name of the parameters for registered functions as it is not something that is needed by the engine.


You can use the user data in the function object to store the parameter names if you wish.




const char *decl = "void SetSize(int nRows, int nCols)";
r = engine->RegisterObjectMethod("Matrix", decl,
    asMETHODPR(Matrix, SetSize, (int,int), void), asCALL_THISCALL);
if( r > 0 )
   asIScriptFunction *func = engine->GetFunctionById(r);

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!