Setting "the result" in XFcn

External developers... This forum's for you!

Setting "the result" in XFcn

Postby Dave_Higgins » Wed Sep 15, 2010 11:58 am

In pure SuperTalk, I work with a tip picked up a while back: If you're running a function, if all you do is "return whateverValue", the calling handler will come up empty when asking for "the result". However, you can set a value for "the result" by running:

Code: Select all
on setResult tData
  return tData
end setResult

That way, your function can return two different values (the direct reply from the function, and "the result") providing additional information.

I'm able to do the same from within an XFcn if I have that "setResult" handler in the message handling path by running SendCardMessage with a string that ends up as setResult "Value for the result", but it doesn't want to set "the result" if I only SendCardMessage return "Value for the result", without the setResult handler being required in the project.

Is there a way that I'm not seeing that we can set "the result" during an XFcn run, so after our XFcn returns, it can be gathered up by the calling handler?
My two favorite teams are Detroit and whoever's playing Chicago.
User avatar
Dave_Higgins
 
Posts: 454
Joined: Mon Jul 07, 2008 9:50 am
Location: Dark Side Of The Moon

Re: Setting "the result" in XFcn

Postby S. Leys » Thu Sep 16, 2010 12:37 am

Dave Higgins wrote:Is there a way that I'm not seeing that we can set "the result" during an XFcn run, so after our XFcn returns, it can be gathered up by the calling handler?


If what you want is that your XFcn returns several results, the simplest way, IMHO, is to return them into arguments passed by pointer.

Code: Select all
local result1,result2 ....
get myX(@result1,@result2 ....)


Then, the XFcn puts something into the handles of the params array.

S.
User avatar
S. Leys
 
Posts: 628
Joined: Sun Jul 06, 2008 11:03 am


Return to Xcode and the Internals Toolbox

Who is online

Users browsing this forum: No registered users and 1 guest