Goto http://www.stucuk.netGoto http://www.atlanticaonlinewiki.comGoto http://www.game-requirements.com

Delete

From Original War Support Wiki

Jump to: navigation, search

SAIL Functions/D -> Delete


Contents

Description

Function Delete deletes value from list with specified index number. Returns resulting list.

Template

Delete(list:plist index:integer)

list - list, from which value will be deleted
index - index number of value to delete (index number is the value's "place" in the list - [3,6,5], 6 has index number 2)

Usage

new_list := Delete(old_list, integer);

new_list - list, in which old_list without offloaded value will be saved

Example

list1 = [56,23,91,8,11];
list2 = Delete(list1,2);  //list2 = [56,91,8,11]

An alternative

Alternatively you can use "diff" to remove a value from a list. "diff" is somewhat more convenient because it removes the value you specify from the list instead of the value with the specified index number.

Export sneaky_list;

Every 0$2 do
  begin
    sneaky_list = [8,4,9,5];
    Wait(0$1);
    sneaky_list = sneaky_list diff 4;
  end;

Now "sneaky_list" equals [8,9,5].
A little disadvantage in using "diff" is that it also removes all doubles from the list.

Export ninja_list;

Every 0$4 do
  begin
    ninja_list = [9,5,8,4,5];
    Wait(0$3);
    ninja_list = ninja_list diff 9;
  end;

Now "ninja_list" holds the following list: [5,8,4]

See also

Personal tools
Clanbase