GameMonkey Script

GameMonkey Script Forums
It is currently Wed Jan 23, 2019 1:16 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Thu Feb 10, 2005 10:37 am 
Offline

Joined: Mon Dec 15, 2003 1:38 pm
Posts: 708
The gmCall interface has been changed to improve handling of return values.

In the past you submitted the return value to be filled. Now you query it after the call has executed. Direct access to the returned gmVariable is also available to allow different return types or return type testing.

The old:
Code:
int valueA=1, valueB=2;
int resultInt = 0;
gmCall call;
if(call.BeginGlobalFunction(&machine, "Add"))
{
  call.SetReturnInt(resultInt);
  call.AddParamInt(valueA);
  call.AddParamInt(valueB);
  call.End();
}
return resultInt;


The new:
Code:
int valueA=1, valueB=2;
int resultInt = 0;
gmCall call;
if(call.BeginGlobalFunction(&machine, "Add"))
{
  call.AddParamInt(valueA);
  call.AddParamInt(valueB);
  call.End();
  call.GetReturnedInt(resultInt);
}
return resultInt;


You may query if the returned value exists, if it is of the correct type, or manually handle the return value.


Top
 Profile  
Reply with quote  
PostPosted: Fri Feb 03, 2012 6:22 am 
Offline

Joined: Tue Jan 31, 2012 7:53 am
Posts: 12
I am having a problem with getting returned user object.
trying to call a script function which returns a user object via gmCall.BeginGlobalFunction and gmCall.GetReturnedUserOrNull, but I couldnt pass the return value parameter:

Code:
gmCall call;
call.BeginGlobalFunction(machine, "Player");
call.End();

GameObj *ret;
call.GetReturnedUserOrNull(ret, ScriptObj::GMTYPE_GAMEOBJ);


error C2664: 'gmCall::GetReturnedUserOrNull' : cannot convert parameter 1 from 'GameObj *' to 'void *&'


Top
 Profile  
Reply with quote  
PostPosted: Fri Feb 03, 2012 6:32 am 
Offline

Joined: Tue Jan 31, 2012 7:53 am
Posts: 12
ah nvm, apparently we cant pass other than void *, casting after getting the return value back to GameObj* should be just fine.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group