LPC Library Functions: filter_array

NAME

filter_array() - return a selective sub-array

SYNOPSIS

mixed *filter_array( mixed *arr, string fun, object ob, mixed extra, ... );

mixed *filter_array( mixed *arr, function f, mixed extra, ...);

DESCRIPTION

filter_array() returns an array holding the items of 'arr' which passed sucessfully through the function 'fun' found in object 'ob'. For each element in 'arr' the function 'fun' is called using that element as the parameter. If given, the second parameter 'extra' and following parameters are sent in each call. An object is considered to have passed sucessfully through 'fun' (and hence is included in the return array) if 'fun' returns 1.

In the second form, a single function pointer 'f' replaces the 'fun' and 'ob' parameters. filter_array() will call 'f' with each element of the array.

If 'arr' is not an array, then 0 will be returned.

Note that filter_array() is a more specific form of filter().

SEE ALSO

sort_array(), map_array(), filter()

Page design by Frank Jacquette & Tim Hollebeek
Copyright (C) 1998 Tim Hollebeek & Frank Jacquette
Back to MudOS