Fill the exclude array() in get_posts()

After three days of struggling and posting a question here I managed to find an answer. Yeh I know… To my defense I can say that it’s my first WP project. I did it this way:

    $exclude = get_excluded_parents();

    $parents = get_posts(
        array(
            'post_type'   => 'jhk_story', 
            'orderby'     => 'ID', 
            'order'       => 'ASC', 
            'numberposts' => -1,
            'exclude'     => $exclude,
        )
    );

    The rest of the code here ...

  }

} // story_frame_attributes_meta_box()


/* 
 * Filters excluded parents from post_type: story_frame
 */
function  get_excluded_parents() {

  // Select all posts with post_type = story_frame
  $childs = get_posts (
    array (
      'post_type'   => 'story_frame',
      'orderby'     => 'ID',
      'order'       => 'ASC',
      'numberposts' => -1
    )
  );

  $exclude = array();

  foreach ( $childs as $child ) {

    if ( 0 < $child->post_parent ) {

      array_push( $exclude, $child->post_parent );

    }

  } // foreach $child

  return $exclude;

} // get_excluded_parents()

Hope someone will benefit from it.