Variable Scoping

David Bovill david at
Mon Oct 9 17:09:27 EDT 2006

Bob - you've lost me here? I suspect there something really basic that one
of us doesn't get - a lost in translation thing.

Environment varaibles are used to pass information between applications ie
the Shell and Revolution or Apache and Revolution - I am pretty sure you
wo"t need them for what you need?

On 09/10/06, Robert Sneidar <bobs at> wrote:
> I am quite familiar with variable scoping. I am just not used to
> scoping that leaves variables in a calling procedure invisible to the
> called procedure.

Which languages do that? Most of the time you really don"t want a global
scope for variables. In fact I try to never use globals. One thing i really
wish for is to be able to make functios and commands private when used in
libraries - I"m a bit lost on what you want here?

This I can use to mimic a kind of "global" variable system without
> having to scour the 450,000+ lines of code for variable names and
> then declare all of them as global at the head of every script that
> uses them.

You can put a global declaration outside of a handler - that is at the top
of any script. So it does not need to be in every handler:

global test

on mouseUp
    put "hello" into test
    put test
end mouseUp

on mouseDoubleUp
    put another_Test()
end mouseDoubleUp

function another_Test
    return test && "world"
end another_Test

More information about the Use-livecode mailing list