[Top]
predef::
|
Method `[]()
- Method
`[]
-
mixed `[](object arg, mixed index)
mixed `[](object arg, string index)
mixed `[](int arg, string index)
mixed `[](array arg, int index)
mixed `[](array arg, mixed index)
mixed `[](mapping arg, mixed index)
int(0..1) `[](multiset arg, mixed index)
int `[](string arg, int index)
mixed `[](program arg, string index)
mixed `[](object arg, mixed start, mixed end)
string `[](string arg, int start, int end)
array `[](array arg, int start, int end)
- Description
-
Index and range operator.
- Returns
-
If arg is an object that implements lfun::`[]() , that function
will be called with the rest of the arguments.
If there are 2 arguments the result will be as follows:
arg can have any of the following types:
object | The non-static (ie public) symbol named index will be looked up
in arg .
|
int | The bignum function named index will be looked up in arg .
|
array | If index is an int, index number index of arg will be
returned. Otherwise an array of all elements in arg indexed
with index will be returned.
|
mapping | If index exists in arg the corresponding value will be
returned. Otherwise UNDEFINED will be returned.
|
multiset | If index exists in arg , 1 will be returned.
Otherwise UNDEFINED will be returned.
|
string | The character (int) at index index in arg will be returned.
|
program | The non-static (ie public) constant symbol index will be
looked up in arg .
|
|
Otherwise if there are 3 arguments the result will be as follows:
arg can have any of the following types:
string | A string with the characters between start and end (inclusive)
in arg will be returned.
|
array | An array with the elements between start and end (inclusive)
in arg will be returned.
|
|
- See also
-
`->() , lfun::`[]()
|