Game Maker Games, Articles, Tutorials & More

Game Maker Network


Howdy, Guest! Please sign in or register an account.

Print

ds_list_filter

By Daniel · December 30, 2008

Filters a list by calling script on each element and retaining only the elements for which the (1-ary) script returns true

/* ds_list_filter(id, script)
 * Filters a list by calling script on each element and retaining only the
 * elements for which the (1-ary) script returns true
 */

var i; i = 0;

while (i < ds_list_size(argument0)) {
  if (script_execute(argument1, ds_list_find_value(argument0, i)))
    i += 1;
  else
    ds_list_delete(argument0, i);
}

Categories: Data processing

Comments

There are no comments to display.

Post a Comment

You must be signed in to post comments.

Advertisement