runebook · rune
runebook · rune
No capabilities requested.
manifest: sha256:df1d2bf42f052bb87f2f4cf8dbe3aac9654a17df631769ec6e70191c2eab0add
rune add @rune/pagination@0.1.0rune add @rune/pagination
import { paginate, numberedLines } from "@rune/pagination";
const page = paginate(players, { page: requestedPage, pageSize: 8 });
sender.sendMessage(`Players (${page.page}/${page.pages})`);
for (const line of numberedLines(page, (player) => player.getName())) {
sender.sendMessage(line);
}
Pages start at one and clamp to the available range. next and previous
are null at the edges. Empty lists have one empty page. Sort a copy of the
source list first if you want a stable ordering across separate requests.