'recent'=>true seems to be returning the opposite

I'm trying to grab the most recent items via this function...

** Simplifies Omeka's looping syntax
function get_item_obj($itemsArray,$num=1){
		set_loop_records('Items', $myItems);
		$items = get_loop_records('Items');
		return $items;

... used as follows...

$items=get_item_obj(array('recent'=>true), 10);
    foreach($items as $item){ /* do something... */ }

For some reason, the $item objects are returned in what appears to be reverse order. Instead of "recent" items, I'm getting the oldest records in my archive.

Can someone explain why that might be happening? I'm at a loss.

I'm not sure, but after a closer look around, I think maybe 'recent' just isn't a valid parameter anymore.

This seems to work ok...

$items=get_item_obj(array('sort_field' => 'added', 'sort_dir' => 'd'), $num);

I'm having a little trouble understanding this function. There's no real purpose to ever call set_loop_records immediately followed by get_loop_records. If you're just looping through the records with a plain ol' foreach and not using loop(), all the Omeka "loop" functions aren't needed at all.

At any rate, assuming you do want the loop-setting in there, these lines:

$items = get_loop_records('Items');
return $items;

are just a roundabout way of doing this:

return $myItems;

Oh, you're right. I don't recall why I felt that needed to be in there. Probably just struggling to figure out why something wasn't working and ended up with some cruft.