GLib.Variant.new_array
function new_array(child_type: GLib.VariantType, children: Array(GLib.Variant)): GLib.Variant { // Gjs wrapper for g_variant_new_array() }
Creates a new GLib.Variant array from children.
child_type must be non-null if n_children is zero. Otherwise, the child type is determined by inspecting the first element of the children array. If child_type is non-null then it must be a definite type.
The items of the array are taken from the children array. No entry in the children array may be null.
All items in the array must have the same type, which must be the same as child_type, if given.
If the children are floating references (see GLib.Variant.prototype.ref_sink), the new instance takes ownership of them as if via GLib.Variant.prototype.ref_sink.
Since 2.24
- child_type
the element type of the new array
- children
an array of GLib.Variant pointers, the children
- Returns
a floating reference to a new GLib.Variant array