REMOVE

From HEWIKI
Jump to: navigation, search

Contents

Remove an item from a list

REMOVE <list> at <position> <range> <disposition>

REMOVE <key> FROM <lookuplist>

This command has two different signatures, depending on whether it is being used on a List or a Lookup List.

Arguments

<list/lookuplist> 
The list that an item is being removed from
<position> 
An integer specifying the location of the list item to be removed
<key> 
The key that is to be removed. This must be of the same type as the lookup list
<range> 
COUNT <aCount> - allows the remove of 'count' elements from a list in one statement
<disposition> 
When dealing with lists of nodes, this specifies whether the removed node should be deleted or not. This field can be in one of two states:
  • KEEP - (default) The node is removed from the list, but is not deleted
  • DESTROY - The node is removed from the list, and is deleted.


Description

This is a HeroScript command that removes an item from a list, or a key from a lookup list. All other list items are shifted accordingly (if item #4 is removed, then item #5 becomes #4, #6 becomes #5, and so forth).

For lists of noderef: If no KEEP or DESTROY disposition is specified in the command, then the default is KEEP -- the node will be removed from the list, but no other action will be taken upon the node. For lists of other types, no disposition is required.

To learn more, please go to List Information.

Example

nodeList as list of node
stringList as list of string
  . . . 
remove nodeList at 3 keep  
remove stringList at 3 
remove stringList at 4 count 6
 
camelot as lookuplist indexed by integer of string
camelot[20] = "Merlin"
camelot[21] = "Arthur"
camelot[22] = "Lancelot"
camelot[15] = "Guinevere"
remove 22 from camelot
 
foreach key in camelot
  println("Key number " + key + " is: " + camelot[key])                    
.
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox