.gsf function return value doesnt work

Pablo Romero romero619 at HOTMAIL.COM
Wed Mar 11 13:37:33 EDT 2009


I'm reposting this question, since I dont know if the listserver rejected it the first time...

I've never been able to get the following to work: use the 'return(varname)' statement within a .gsf function to return a value.

I've only been able to accomplish the passing of variables around between scripts by using '_varname' global variables, but this defeats the whole purpose of creating a script function.

I want to create a .gsf function that can actually return a value that can be directly assigned to a variable in a .gs file.

example:

*gsf file, addit.gsf

function addit(var1,var2)
sum=var1+var2
return (sum)

*test gs file, tst.gs

rc = gsfallow("on")
tx=addit(2,3)
say '2+3 is 'tx

however, this doesnt work...
it simply prints '2+3 is ', so the gsf function is NOT returning the value of the 'sum' variable...

Is this by design or am I doing something incorrectly?
are global variables the ONLY way to pass variables between script/script function files?

If this *is* by design, then I would please like to submit a request to COLA to consider fixing this in future versions.

P.Romero
_________________________________________________________________
Windows Live™ Contacts: Organize your contact list.
http://windowslive.com/connect/post/marcusatmicrosoft.spaces.live.com-Blog-cns!503D1D86EBB2B53C!2285.entry?ocid=TXT_TAGLM_WL_UGC_Contacts_032009



More information about the gradsusr mailing list