LPC Library Functions: filter_mapping

NAME

filter_mapping - return a selective sub-mapping

SYNOPSIS

mapping filter( mapping x, string fun, object ob, mixed extra, ... );

mapping filter( mapping x, function f, mixed extra, ...);

DESCRIPTION

filter_mapping returns a mapping holding the items of 'x' which passed sucessfully through the function 'fun' found in object 'ob'.

For each element in 'x' 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 mapping) if 'fun' returns 1.

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

If 'x' is not a mapping, then 0 will be returned.

Note that filter_mapping() is a restricted form of filter().

SEE ALSO

sort_array(), map_array(), filter_array(), filter()

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