I agree with Genius.

Regardless, $hget(table,0).item will return total items.

Code:
var %r = $hget(table,0).item | while (%r) {

dec %r
}