lookup


Description:

[ Version ( since = "2.28" ) ]
public bool lookup (string key, string format_string, ...)

Looks up a value in a dictionary Variant.

This function is a wrapper around lookup_value and @get. In the case that null would have been returned, this function returns false. Otherwise, it unpacks the returned value and returns true.

format_string determines the C types that are used for unpacking the values and also determines if the values are copied or borrowed, see the section on [`GVariant` format strings](gvariant-format-strings.html#pointers).

This function is currently implemented with a linear scan. If you plan to do many lookups then VariantDict may be more efficient.

Parameters:

this

a dictionary Variant

key

the key to look up in the dictionary

format_string

a GVariant format string

...

the arguments to unpack the value into

Returns:

true if a value was unpacked