Programmer Guide/Command Reference/ATTRIBUTES: Difference between revisions

From STX Wiki
Jump to navigationJump to search
 
(13 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
== ATTRIBUTES ==
The <code>ATTRIBUTES</code> command retrieves a blank-separated list of attributes of a [[Programmer_Guide/Shell_Items|shell item]], or of variables available in a given context.
==Usage==
ATTRIBUTES <var>item</var>
: returns a blank-separated list of all available attributes for the supplied [[Programmer_Guide/Shell_Items|shell item]] <var>item</var>


=== Overview ===
ATTRIBUTES GLOBAL
:returns a blank-separated list of all [[Programmer_Guide/Introduction#Global_Variables|global variables]]


The <code>ATTRIBUTES</code> command retrieves a blank-separated list of attributes of a [[Programmer_Guide/Shell_Items/Introducing_Shell_Items|shell item]], or of variables available in a given context.
ATTRIBUTES SHELL
:returns a blank-separated list of all [[Programmer_Guide/Introduction#Shell_Variables|shell variables]]


=== Usage ===
ATTRIBUTES MACRO
:returns a blank-separated list of all [[Programmer_Guide/Introduction#Macros|local variables]] of the current macro or member function


;<code>#list := ATTRIBUTES item|MACRO|SHELL|GLOBAL</code>: returns the blank-separated list of all available attributes for the supplied shell item <code>item</code> or a list of variables available:
ATTRIBUTES INSTANCE
:* in the current macro, if <code>ATTRIBUTES MACRO</code> is used;
:returns a blank-separated list of all [[Programmer_Guide/Introduction#Classes.2C_Instances|member variables]] of the instance. This command can only be used in member functions of a class.
:* in the current shell, if <code>ATTRIBUTES SHELL</code> is used;
:* globally, if <code>ATTRIBUTES GLOBAL</code> is used.


=== Example ===
==See also==
The example script <code>scripts\examples\reflection.sts</code> demonstrates the use of the <code>ATTRIBUTES</code> command and some other possibilities to retrieve attributes and properties of shell items.
 
==Example==
  #table := new table *
  #table := new table *
  #list := ATTRIBUTES $#table
  #list := ATTRIBUTES $#table
  um 'The item attributes available for a table item are: $#list'
  um 'The item attributes available for a table item are: $#list'
  delete /Var #list
  delete /Var #table
 
See also the example script <code>relection.sts</code>.


<!-- C.G. 11.3.2011 -->
<!-- C.G. 11.3.2011 -->
<!-- A.N. 27.4.2011 -->

Latest revision as of 15:40, 24 April 2014

The ATTRIBUTES command retrieves a blank-separated list of attributes of a shell item, or of variables available in a given context.

Usage

ATTRIBUTES item
returns a blank-separated list of all available attributes for the supplied shell item item
ATTRIBUTES GLOBAL
returns a blank-separated list of all global variables
ATTRIBUTES SHELL
returns a blank-separated list of all shell variables
ATTRIBUTES MACRO
returns a blank-separated list of all local variables of the current macro or member function
ATTRIBUTES INSTANCE
returns a blank-separated list of all member variables of the instance. This command can only be used in member functions of a class.

See also

The example script scripts\examples\reflection.sts demonstrates the use of the ATTRIBUTES command and some other possibilities to retrieve attributes and properties of shell items.

Example

#table := new table *
#list := ATTRIBUTES $#table
um 'The item attributes available for a table item are: $#list'
delete /Var #table


Navigation menu

Personal tools