|
Asilient_1 Apprentice
Joined: 26 Apr 2007 Posts: 113
|
Posted: Sat Apr 28, 2007 3:06 pm
Questions about Modules. |
Okay. So I've started playing around with modules, the help file isn't very, er, helpful in what limits there are to modules, so I've got a question.
Is it possible to refer to variables in other modules that are currently loaded, or do classes have to be used for that?
I'll probably come up with more as I go along.
Thanks for any help. |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sat Apr 28, 2007 4:30 pm |
Modules = Windows, except that Modules have the ability to share their settings with other modules and windows. Windows don't share anything, so a Module can't see the variables and stuff that are in the Windows.
It's an ability, in that there are several options that change the visibility of that module. For instance, you can keep it local to the current package, you can make it invisible to the current package, or you can make it visible to every package. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Apr 30, 2007 5:48 pm |
To refer to a variable in a specific module, you can use the syntax:
#SHOW @//modulename/varname |
|
|
|
Asilient_1 Apprentice
Joined: 26 Apr 2007 Posts: 113
|
Posted: Tue May 01, 2007 10:48 am |
So to refer to a variable in a different module in an if statment would work like...
#IF (@//modulename/varname AND @thisvariable AND @//differentmodule/differentvariable) {say hi}
That's how I understand it? |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue May 01, 2007 5:04 pm |
Yep. Just keep in mind that this bypasses normal scoping rules, and you might end up with scripts that are hard to support if you start regularly accessing variables in other non-global modules. So it should only be used when absolutely necessary. Normally you'd just want to make your module Global.
|
|
|
|
Asilient_1 Apprentice
Joined: 26 Apr 2007 Posts: 113
|
Posted: Tue May 01, 2007 8:09 pm |
Got it. Thanks for the help.
|
|
|
|
|
|