language syntax question

Sean Cole (Pi) sean at pidigital.co.uk
Wed Nov 19 15:41:26 EST 2014


On 19 November 2014 20:14, Michael Doub <mikedoub at gmail.com> wrote:

> local savebuf, savedcallback, savedobj
> On initialize_read @buf, obj
>     put (the address of buf) into savebuf  -- How do I do this?
>     put obj into savedobj
>     open file serialport
> end initialize_read
>

It depends on *where* you want to save it. If you just want to put it into
a variable that is held until closeStack then create a global variable and
store it into that, e.g.:

global gSaveBuf
local savebuf, savedcallback, savedobj
On initialize_read @buf, obj
    put (the address of buf) into gSaveBuf  -- Saved to a global that, as
long as you call the global with the same name in each objects script, will
keep the same data. I personally prefer to use globals than referenced
variables
    put obj into savedobj
    open file serialport
end initialize_read

Alternatively to save it to the hard drive or other more permanent storage
than ram you could use:

put (the address of buf) into url("file:" & myFileName)

Again, I really hope this helps you out.

All the best

Sean Cole
*Pi Digital Productions Ltd*
www.pidigital.co.uk



More information about the use-livecode mailing list