I want to write a function that will read and write to any named global.  What 
I have below seems to work, but I’m not sure quite why.  Usually, “put gName 
into oldVal” for a global named gName would put the value, not the name, of 
that global into oldVal.  But here it does not.

function globalSwap gName,gVal
   -- Return the existing value of global gName and load gVal into that same 
global
   do "global" && gName
   do "put" && gName && "into oldVal" # "put gName into oldVal" doesn't work 
here.
   do "put gVal into" && gName
   return oldVal
end globalSwap

Is there some way to write this with fewer or no uses of “do”?

David Epstein
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to