Search for needle in haystack . Return the position of needle in
haystack or -1 if not found.
If the optional argument start is present search is started at
this position.
haystack can have any of the following types:
string
When haystack is a string needle must be a string or an int,
and the first occurrence of the string or int is returned.
array
When haystack is an array, needle is compared only to
one value at a time in haystack .
mapping
When haystack is a mapping, search() tries to find the index
connected to the data needle . That is, it tries to lookup the
mapping backwards. If needle isn't present in the mapping, zero
is returned, and zero_type() will return 1 for this zero.
object
When haystack is an object implementing lfun::_search() ,
the result of calling lfun::_search() with needle will
be returned.
If haystack is an object that doesn't implement lfun::_search()
it is assumed to be an Iterator , and implement
Iterator()->index() , Iterator()->value() , and
Iterator()->next() . search() will then start comparing
elements with `==() until a match with needle is found.
If needle is found haystack will be advanced to the element,
and the iterator index will be returned. If needle is not
found, haystack will be advanced to the end (and will thus
evaluate to false), and a zero with zero_type 1 will be returned.