FYI, initializing variables by reference

Peter M. Brigham pmbrig at gmail.com
Mon Jun 18 10:24:19 EDT 2012


For some reason I never realized that you can use referenced variables in a command handler -- I was thinking of them only when using functions. In case others haven't discovered it, you can, for instance, do something like this:

on prepareInvoice tID
  initializeVars tID, tName, tDOB, tAddr, tPhone
  -- now you can go on and do something
  --     with the initialized variables
  -- ...
end prepareInvoice

on initializeVars tID, @tName, @tDOB, @tAddr, @tPhone
  put fetchData(tID) into tArray
  put tArray["name"] into tName 
  put tArray["DOB"] into tDOB
  put tArray["ID"] into tID
  put tArray["address"] into tAddr 
  put tArray["phone"] into tPhone
end initializeVars

This may not be new to some, but it was new to me.

-- Peter

Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig





More information about the Use-livecode mailing list