Jump to content

  • Log In with Google      Sign In   
  • Create Account


- - - - -

Register Parameter Names


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Jason Goepel   Members   -  Reputation: 401

Like
0Likes
Like

Posted 17 September 2013 - 01:08 PM

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:

func->GetDeclaration(true,false);

 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?

 

Thanks!

 



Sponsor:

#2 Andreas Jonsson   Moderators   -  Reputation: 3290

Like
2Likes
Like

Posted 17 September 2013 - 01:22 PM

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.

 

Example:

 

 
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);
   func->SetUserData(decl);
}

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




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS