local <-> global variable

Help for those learning Tcl or writing their own scripts.
Post Reply
j
joke
Voice
Posts: 13
Joined: Fri Aug 19, 2005 7:20 am
Location: Karlsruhe
Contact:

local <-> global variable

Post by joke »

Hi guys,

is it possible to have a variable to be known in the whole script, but NOT in every script? I mean, can I have a variable between local and global?

For example: a part of test.tcl
---------------------------------------------------------------------------------
set x "bla"

proc test1 {...} {
puthelp "PRIVMSG #test-chan :$x"
}

proc test2 {...} {
puthelp "PRIVMSG #test-chan :$x"
}

---------------------------------------------------------------------------------

Is it possible to make the variable x known in both procedures (test1, test2) without making x global? I want to have x to be known in test.tcl but NOT in my other tcl scripts.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

use namespaces
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
Post Reply