has_list Function

public function has_list(table, key)

Check if an instance of the TOML data structure contains a list

Arguments

Type IntentOptional Attributes Name
type(toml_table), intent(inout) :: table

Instance of the TOML data structure

character(len=*), intent(in) :: key

Key to read from

Return Value logical


Source Code

    logical function has_list(table, key)
    
        !> Instance of the TOML data structure
        type(toml_table), intent(inout) :: table

        !> Key to read from
        character(len=*), intent(in) :: key

        type(toml_array), pointer :: children
        
        has_list = .false.

        if (.not.table%has_key(key)) return

        call get_value(table, key, children, requested=.false.)
        
        ! There is an allocated list
        has_list = associated(children)
        
    end function has_list