egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

local <-> global variable

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
joke
Voice


Joined: 19 Aug 2005
Posts: 13
Location: Karlsruhe

PostPosted: Sun Jun 18, 2006 4:20 am    Post subject: local <-> global variable Reply with quote

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.
Back to top
View user's profile Send private message Visit poster's website
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Sun Jun 18, 2006 5:23 am    Post subject: Reply with quote

use namespaces
_________________
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber