as

Convenience function that attempts to extract a property value from a property list (an associative array of strings indexed by strings) and convert it to a specified type.

  1. T as(string[string] properties, string name, T alternative)
    T
    as
    (
    T
    )
    (
    string[string] properties
    ,
    string name
    ,
    T alternative = T.init
    )
  2. bool as(string[string] properties, string name, T alternative)

Parameters

properties string[string]

The associative array to locate the property in.

name string

The name the value is currently keyed under.

alternative T

The value to return in the case that the properties list doesn't contain the named property. Defaults to whatever the default initialization value for the desired type is.

Meta