Hash tables don't have a top. I suggest adding actual entries as numerical indices and have some other keys (current, next, last) which point to the indices.

on *:text:!songrequest*:#:{
  hinc playlist last
  hadd playlist $hget(playlist,last) $2

on *:text:!nextsong:#:{
  if ($hget(playlist,current)) hdel playlist $v1
  hinc playlist current

  echo -ag current song is $hget(playlist,$hget(playlist,current))

All that said, appending to a plain text file then reading and deleting the first line would not be a terrible implementation for this either.

Last edited by Loki12583; 11/03/15 10:03 PM.