Programmer Guide/Command Reference/LIST: Difference between revisions

From STX Wiki
Jump to navigationJump to search
No edit summary
 
(7 intermediate revisions by 2 users not shown)
Line 6: Line 6:
  <var>var</var> := LIST <var>type</var> <var>table</var> [ <var>field</var> [ <var>reset</var> ] ]
  <var>var</var> := LIST <var>type</var> <var>table</var> [ <var>field</var> [ <var>reset</var> ] ]


The <code>LIST</code> command retrieves a list of all shell items of the type named by the <code>type</code> argument, or of macros, SPUs, or soundfiles (see the table below). It will store this list in the {{STX}} table item <var>table</var>. Here, <var>table</var> may be either a simple table or an extended table. In the latter case, by supplying <var>field</var>, you may choose the field where to store the names of the retrieved shell items.
The <code>LIST</code> command retrieves a list of all shell items of the type named by the <code>type</code> argument, or of macros, [[Programmer_Guide/Shell_Items/SPU|SPUs]], or soundfiles (see the table below). It will store this list in the {{STX}} table item <var>table</var>. Here, <var>table</var> may be either a [[Programmer_Guide/Concepts/Simple_table|simple table]] or an [[Programmer_Guide/Concepts/Extended_table|extended table]]. In the latter case, by supplying <var>field</var>, you may choose the field where to store the names of the retrieved shell items.


You may use the <var>reset</var> argument for implicitly clearing the table item before retrieving the list of shell items, with <code>1</code> causing the table to be cleared, and <code>0</code> leaving the current contents of the table unharmed, and ''appending'' the retrieved item list to the table.
You may use the <var>reset</var> argument for implicitly clearing the table item before retrieving the list of shell items, with <code>1</code> causing the table to be cleared, and <code>0</code> leaving the current contents of the table unharmed, and ''appending'' the retrieved item list to the table.
Line 13: Line 13:
|-
|-
|type
|type
|a shell item type or <code>MACROCODE</code>, <code>SPUCODE</code>, <code>SOUNDFILE</code>, or <code>CLASS</code>
|a shell item type, or one of the keywords <code>MACROCODE</code>, <code>SPUCODE</code>, <code>SOUNDFILE</code>, and <code>CLASS</code>
|-
|-
|table
|table
Line 19: Line 19:
|-
|-
|field
|field
|target field (if table is an extended table)
|target field (if table is an [[Programmer_Guide/Concepts/Extended_table|extended table]])
|-
|-
|reset
|reset
|clear target table ( <code>0</code> or <code>1</code> )
|clear target table (<code>0</code> or <code>1</code>)
|}
|}
===Example===
// display list of loaded macros in current shell
#tListMacros := new table * /g
list macrocode $#tListMacros
showitem $#tListMacros


== Counting shell items ==
== Counting shell items ==
Line 29: Line 35:
  <var>var</var> := LIST <var>type</var>
  <var>var</var> := LIST <var>type</var>


Without any further arguments, the <code>LIST</code> command simply returns the number of shell items of type <var>type</var>, or of macros, SPUs, or soundfiles (see the table below).  
Without any further arguments, the <code>LIST</code> command simply returns the number of shell items of type <var>type</var>, or of macros, SPUs, or sound files (see the table below).  
{|
{|
|-
|-
|type
|type
|a shell item type or <code>MACROCODE</code>, <code>SPUCODE</code>, <code>SOUNDFILE</code>, or <code>CLASS</code>
|a shell item type, or one of the keywords <code>MACROCODE</code>, <code>SPUCODE</code>, <code>SOUNDFILE</code>, and <code>CLASS</code>
|-
|-
|}
|}

Latest revision as of 13:32, 14 April 2016

The LIST command may be used for retrieving the list of all shell items of a certain type; of for simply counting how many items of a certain type there are.

Retrieving a list of shell items

var := LIST type table [ field [ reset ] ]

The LIST command retrieves a list of all shell items of the type named by the type argument, or of macros, SPUs, or soundfiles (see the table below). It will store this list in the STx table item table. Here, table may be either a simple table or an extended table. In the latter case, by supplying field, you may choose the field where to store the names of the retrieved shell items.

You may use the reset argument for implicitly clearing the table item before retrieving the list of shell items, with 1 causing the table to be cleared, and 0 leaving the current contents of the table unharmed, and appending the retrieved item list to the table.

type a shell item type, or one of the keywords MACROCODE, SPUCODE, SOUNDFILE, and CLASS
table target table item
field target field (if table is an extended table)
reset clear target table (0 or 1)

Example

// display list of loaded macros in current shell
#tListMacros := new table * /g
list macrocode $#tListMacros
showitem $#tListMacros

Counting shell items

var := LIST type

Without any further arguments, the LIST command simply returns the number of shell items of type type, or of macros, SPUs, or sound files (see the table below).

type a shell item type, or one of the keywords MACROCODE, SPUCODE, SOUNDFILE, and CLASS

Navigation menu

Personal tools