Jump to content

View more

Image of the Day

Working on an auto spawn system. #gamedev #indiedev #screenshotsaturday https://t.co/Mm2kfekz7b
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now
- - - - -

[Solved]Unable to pass global object function to globalfunction

4: Adsense

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
3 replies to this topic

#1 Zervoxe   Members   

1209
Like
0Likes
Like

Posted 28 June 2013 - 03:05 PM

I am new to AngelScript and in need of help. ;)

 

as per the suggestion here.

http://www.angelcode.com/angelscript/sdk/docs/manual/doc_register_func.html







r = engine->RegisterGlobalFunction("void AppName(const Str &in)", asMETHODPR(Application, name,Str,Application), asCALL_THISCALL_ASGLOBAL, &App);

I get error









C2061: syntax error : identifier 'Str'

if I do (Str)

 

'static_cast' : cannot convert from 'overloaded-function' to 'Application (__thiscall Application::* )(Str)'
1> None of the functions with this name in scope match the target type











r = engine->RegisterGlobalFunction("void AppName(const Str &in)", asMETHOD(Application, name), asCALL_THISCALL_ASGLOBAL, &App);
d:\prod\main.cpp(66): error C2440: 'type cast' : cannot convert from 'overloaded-function' to 'void (__thiscall Application::* )(void)'
1> None of the functions with this name in scope match the target type


struct Application{ // Application Settings

Application& name (const Str &name); // set application name
const Str& name ( ) {return _name ;} // get application name


}extern App


Edited by Zervoxe, 29 June 2013 - 02:01 AM.


#2 SiCrane   Moderators   

11759
Like
0Likes
Like

Posted 28 June 2013 - 03:12 PM

For asMETHODPR() the third parameter should be a parenthesis wrapped list of the parameter types of the member function. In your case you want (const Str &). (Str) doesn't work because your function doesn't actually take a Str, it takes a const Str &.

#3 Zervoxe   Members   

1209
Like
0Likes
Like

Posted 28 June 2013 - 03:15 PM

Unfortunately I've already tried that and it only returns

d:\Prod\main.cpp(66): error C2440: 'static_cast' : cannot convert from 'overloaded-function' to 'Application (__thiscall Application::* )(const Str &)'
1> None of the functions with this name in scope match the target type

Edit:

 

Ahhh.. forgot Application& at the end instead I had Application...

 

Thanks for fast reply. :)


Edited by Zervoxe, 28 June 2013 - 03:18 PM.


#4 SiCrane   Moderators   

11759
Like
0Likes
Like

Posted 28 June 2013 - 03:16 PM

The return type also has to match exactly. You have Application when it should be Application &




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.