Thunderstone Software Document Retreival and Management
Search:
Advanced Search
Home | Products | Company | News | Tech Support | Demos | Contact Us
Vortex Manual

Function Parameters

 

Script functions can be declared with parameters gif , which are passed to the function when it is called. Parameters are declared by naming them in the <A NAME> declaration tag, after the NAME attribute and any scope attribute (PUBLIC/PRIVATE etc.) . Each parameter is a local variable (p.  gif ) inside the function:

<A NAME=banner title="Untitled" bg>
  <HEAD>
    <TITLE>$title</TITLE>
  </HEAD>
  <BODY BGCOLOR=$bg>
  <CENTER>
    <H2>$title</H2>
  </CENTER>
</A>

This function has two parameters, $title and $bg. When the function is called, its arguments are named in the tag (like HTML attributes):

  <banner title="Search Results" bg=white>

Since the arguments are named gif , they need not be given in order (like HTML). Nor are all parameters required: the $title parameter was declared with a default value of ``Untitled'', so it will have that value if unspecified in a call:

  <banner bg=white>

Parameters without default values (eg. $bg) are required, however. This provides the ability to force their setting in situations where a default value might not be useful. For example, a search-and-replace type function could require its search and buffer parameters: it may not be sensible to search a default buffer.

The default value for a parameter can also be a variable:

<A NAME=banner title=$DefaultTitle bg>
  ...
</A>

In this case, if $title is not specified in a call, it will have the value of the global (never local) variable $DefaultTitle.


Copyright © Thunderstone Software     Last updated: Wed Aug 6 11:57:09 EDT 2008
 
Home   ::   Products   ::   Company   ::   News   ::   Tech Support   ::   Demos   ::   Contact Us
Copyright © 2008 Thunderstone Software LLC. All rights reserved.