preopenStack
J. Landman Gay
jacque at hyperactivesw.com
Sun Jan 18 23:27:18 EST 2009
Generic Email wrote:
> I have a stack with a fld "test"
> this code fails on startup
>
> on preopenStack
> put URL "http://screen-share.com/" into eml
> put "test" into field "test"
> end preopenStack
>
> This code succeeds on startup
>
> on preopenStack
> --put URL "http://screen-share.com/" into eml
> put "test" into field "test"
> end preopenStack
>
> Can someone explain why this is failing? It is very frustrating.
The variable "eml" is probably getting content (assuming the server
returned something,) but it doesn't look like you've declared it a
global or script variable, so the variable and its content are discarded
at the end of the handler. If you want to use that value elsewhere, you
have to save it between handlers. If your handlers are all in the same
script, making "eml" a script variable will do it. You can also make it
a global variable, but that's generally discouraged unless it's really
necessary.
To create a script variable -- which means the value will be accessible
by any handler contained in that script -- you just declare it at the
top of the script before any handlers, like so:
local eml
on preopenstack
put URL "http://screen-share.com/" into eml
end preopenstack
Now any other handler in that script can refer to "eml" and use its content.
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list