A
          / \      _             Play Now                         Nemesis on fb
          | |     | |  _______   _        _   _______    _______   _    _______
          | |\    | | |   ____| |  \    /  | |   ____|  /   ____| | |  /   ____|
 /-------/-------------------------------------------------------------------,
O= Home <=XX|  About  News  Pics  Adventurers  Wizards  Download  Connect     >
 \-------\-------------------------------------------------------------------'
          | |   \   | |  |____  | |      | | |  |____   ___ \  \  | |  ___ \  \
          | |     \_| |_______| |_|      |_| |_______| |_______/  |_| |_______/
          \ /
           V  

Documentation Area

Document Path: /doc/efun/filter_array


Name: filter_array - filtered search through an array

Syntax:
	mixed *filter_array(mixed *arr, string fun, object ob, mixed extra)

Description:
	The filter_array efun returns an array holding the items of 'arr'
	filtered through 'ob->fun()'. The function 'fun' in 'ob is called for
	each element in 'arr' with that element as parameter. A second
	parameter 'extra' is sent in each call if given.

	If 'ob->fun(arr[.index.], extra)' returns 1, the element is included
	in the returned array. 

Return value:
	As described above. If 'arr' is not an array, 0 will be returned.

Examples:
	Get all files from a dir that are readable and are real files:

	check_dir() {
		dir=get_dir("/text/*");
		dir=filter_array(dir, "check_file", this_object());
	}

	check_file(str) { if (file_size(str)>0) return 1; }	

See also:


This page was generated in LPC

Imprint / Impressum