From STX Wiki
< Programmer Guide‎ | Command Reference
Revision as of 22:22, 29 April 2014 by Christian (talk | contribs) (→‎Examples)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
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 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 command 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 STx gorgeous!


#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

STx 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

STx stores all supported color constants in the table colorTable and stores the number of entries in #nColors.