Limit a number of users returned from sorting users by latest posts function

function get_users_ordered_by_post_date($offs=0, $lim=10, $ord='DESC') {
  global $wpdb;
  if(!is_numeric($offs) || !is_numeric($lim) || !in_array(strtoupper($ord), array('ASC','DESC'))) return array();
  $q = "SELECT DISTINCT post_author FROM {$wpdb->posts} WHERE post_status="publish" AND post_type="post" ORDER BY post_date {$ord} LIMIT {$offs}, {$lim}";
  $users = $wpdb->get_results($q, ARRAY_N);
  foreach($users as $i => $u) $users[$i] = get_userdata($users[$i][0]);
  return $users;
}

ARRAY_N sets the return typs as an array of non-associative arrays.