Site Tools


stub

Table of Contents

# $EPIC: stub.txt,v 1.5 2006/08/29 18:22:56 sthalik Exp $

Synopsis:

stub alias|assign <alias/var>[,<alias/var>] <filename> [<filename> …]

Description:

The STUB allows you to set up a load-on-demand alias or assign. You may STUB any alias or variable name to a filename. Whenever a stubbed alias or variable name is looked up, the stub is deleted, and the lookup is interrupted while the filename to which the alias is stubbed is loaded. After the load, the lookup continues as normal. If the script that is loaded does not actually define a real value for the alias or assign, then after the load the alias or assign is treated as any other undefined value.

STUBs are automatically deleted whenever they are first used. They can also be deleted if a real alias or assign value is given to them. (So for example, you can stub 3 aliases to the same file, and when that file is loaded, it /aliases all 3 of them, so all 3 stubs go away)

STUBs can load more than one file at a time.

The idea of using STUBs is to shorten load times by not having to take the time to load files implementing features your script may offer that the user will never use. If the user does use the feature, then it is loaded on demand and they never know the difference.

Examples:

To load the file foobar.irc when the /foo command is issued:

    stub alias foo foobar.irc
    

To load footoo.irc when $foo and $bar are accessed:

    stub assign foo,bar footoo.irc
stub.txt · Last modified: 2006/08/29 20:18 by 127.0.0.1