Array (array
)
An array of elements. See arrays.
Returned by
Array objects are returned by the following functions and methods:
files()
get_option()
array.flatten()
cfg_data.keys()
compiler.cmd_array()
compiler.first_supported_argument()
compiler.first_supported_link_argument()
compiler.get_supported_arguments()
compiler.get_supported_function_attributes()
compiler.get_supported_link_arguments()
compiler.preprocess()
custom_tgt.to_list()
dict.keys()
meson.project_license()
meson.project_license_files()
str.split()
str.splitlines()
Array methods
array.contains()
Returns true
if the array contains the object
given as argument, false
otherwise
Signature
# Returns `true` if the array contains the object
bool contains(
any item, # The item to check
)
Arguments
Argument flattening is NOT SUPPORTED by this function.
The method array.contains()
accepts the following positional arguments:
Name | Type | Description | Tags |
---|---|---|---|
item |
any |
The item to check |
|
array.flatten()
Returns a flattened copy of the array, with all nested arrays removed.
Signature
(since 1.9.0)
array[any] flatten()
array.get()
returns the object at the given index,
negative indices count from the back of the array, indexing out of
bounds returns the fallback
value (since 0.38.0) or, if it is
not specified, causes a fatal error
Signature
# returns the object at the given index,
any get(
int index, # Index of the array position to query
any [fallback], # Fallback value that is returned if the index is out of range
)
Arguments
Argument flattening is NOT SUPPORTED by this function.
The method array.get()
accepts the following positional arguments:
Name | Type | Description | Tags |
---|---|---|---|
index |
int |
Index of the array position to query. Negative values start at the end of the array |
|
fallback |
any |
Fallback value that is returned if the index is out of range. |
[optional] |
array.length()
Returns the current size of the array.
Signature
int length()
The results of the search are