Setting text to loop in the HUD

I was wondering how you would set text to move across the screen, like some gamemodes have, and loop it so it continouosly does it.

So it would go say, from the right of the screen, across a darkened box, towards the left of the screen, and disappear into the left.

[lua]textX = textX + FrameTime( ) * speed;

if( textX > ScrW( ) ) then

textX = -textWidth;


// draw text[/lua]

If you want the text to have a ‘portal’ effect, you’ll have to draw it twice when it’s partway off the screen.

How would I make it so my text links with that function?