Programmer Guide/Command Reference/STXCONSTANTS: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:{{SUBPAGENAME}}}} | {{DISPLAYTITLE:{{SUBPAGENAME}}}} | ||
<var>var</var> := STXCONSTANTS | <var>var</var> := STXCONSTANTS <var>constanttype</var> [ <var>table</var> ] | ||
<var>var</var> := STXCONSTANTS * [ <var>table</var> ] | |||
The <code>STXCONSTANT</code> command returns the list of constants | The <code>STXCONSTANT</code> command returns the list of constants of a certain type, <var>constanttype</var> (see below). If the <var>table</tab> argument is present, then it must specify an {{STx}} table. In this case, the table will be cleared, and the respective list of constants will be stored in the table, one entry per constant. In this case, the command will return the total number of constants returned. | ||
If no <var>table</var> argument is supplied, the command will return the respective list as a string containing the names of all constants, separated by blanks. | |||
If you do not know what constants {{STX}} supports, i.e., what values you may supply for <var>constanttype</var> (we don't know this either!), the second form of the <code>STXCONSTANTS</code> comnmand comes in handy: If you supply the command only with an asterisk for its arguments, the command will return a list of constant types, cleanly separated by blanks. If you add the <var>table</var> argument, which must be a table, the list of constant types will be stored in the table, one entry per constant (any old content of the table will get lost). In the latter case, the command returns the number of the supported constants. Now isn't all that gorgeous! | |||
== Examples == | == Examples == | ||
#stxConstants := STXCONSTANTS * | <var>#stxConstants</var> := STXCONSTANTS * | ||
{{Stx|caps}} will return a blank-separated list of the constants supported. In turn, each word in this list is valid for the <var>constanttype</var> argument to the <code>VAR STXCONSTANTS</code> command. | |||
#nConstants := STXCONSTANTS * | <var>#nConstants</var> := STXCONSTANTS * <var>item7</var> | ||
Stores all constants supported by the <code>VAR STXCONSTANTS</code> command in the table <var>item7</var>, and returns their the number, which, in turn, gets assigned to <var>#nConstants</var>. | |||
#nColors := STXCONSTANTS COLORS colorTable | <var>#nColors</var> := STXCONSTANTS COLORS <var>colorTable</var> | ||
Adds all supported color constants to the table < | Adds all supported color constants to the table <var>colorTable</var> and stores the number of entries in <var>#nColors</var>. |
Revision as of 21:18, 29 April 2014
var := STXCONSTANTS constanttype [ table ] var := STXCONSTANTS * [ table ]
The STXCONSTANT
command returns the list of constants of a certain type, constanttype (see below). If the table</tab> argument is present, then it must specify an STx table. In this case, the table will be cleared, and the respective list of constants will be stored in the table, one entry per constant. In this case, the command will return the total number of constants returned.
If no table argument is supplied, the command will return the respective list as a string containing the names of all constants, separated by blanks.
If you do not know what constants STx supports, i.e., what values you may supply for constanttype (we don't know this either!), the second form of the STXCONSTANTS
comnmand comes in handy: If you supply the command only with an asterisk for its arguments, the command will return a list of constant types, cleanly separated by blanks. If you add the table argument, which must be a table, the list of constant types will be stored in the table, one entry per constant (any old content of the table will get lost). In the latter case, the command returns the number of the supported constants. Now isn't all that gorgeous!
Examples
#stxConstants := STXCONSTANTS *
STx will return a blank-separated list of the constants supported. In turn, each word in this list is valid for the constanttype argument to the VAR STXCONSTANTS
command.
#nConstants := STXCONSTANTS * item7
Stores all constants supported by the VAR STXCONSTANTS
command in the table item7, and returns their the number, which, in turn, gets assigned to #nConstants.
#nColors := STXCONSTANTS COLORS colorTable
Adds all supported color constants to the table colorTable and stores the number of entries in #nColors.