Skip to content

$index

$index will return the current index of a loop.

Usage

$index

Example(s)

This will create a loop and return the index, starting with 0 instead of 1:

1
client.command({
2
name: "loop",
3
code: `
4
$loop[5;{ "channel": "$channelID" };index]
5
`
6
});

We use $index to retrieve the current index:

1
client.awaitedCommand({
2
name: "index",
3
code: `
4
$channelSendMessage[$awaitData[channel];The current loop index is: $index]
5
` // returns 5 messages counting from 0 to 4
6
});