Why doesn't this code work?

This comes straight from the codex

<?php
global $post;
$args = array( 'numberposts' => 5, 'offset'=> 1, 'category' => 1 );
$myposts = get_posts( $args );
foreach( $myposts as $post ) :	setup_postdata($post); ?>
	<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>

according to the codex, that code should list the posts of category 1 but nothing shows up. Does this have to be inside the_loop() ?

never mind, solved it