Denovo

Lists

Lists and maps, for keeping several values together.

all players

all players

A list of every player on the server right now. Go through it with for each to do something to everyone.

Gives back: Player>

Script: onlinePlayers()

players in [World]

players in World

A list of the players in one world right now. Use all players instead to include every world.

SlotTakesWhat it is for
1WorldThe world to look in.

Gives back: Player>

Script: world.getPlayers()

add [any value] to [list]

add any value to List

Adds an item to the end of a list. A list holds at most 10,000 items; adding past that stops the script with an error.

SlotTakesWhat it is for
1any valueThe item to add.
2listThe list to add to.

Script: list.add(value)

insert [any value] at [number] in [list]

insert any value at 0 in List

Puts an item into a list at a position, moving everything from there onwards one place along. Positions count from 0, and the position just past the last item adds to the end. Any other position, or going past 10,000 items, stops the script with an error.

SlotTakesWhat it is for
1any valueThe item to insert.
2numberWhere to put the item, counting from 0.
3listThe list to insert into.

Script: list.insert(number, value)

item [number] of [list]

item 0 of List

The item at a position in a list. Positions count from 0, so the first item is 0 and the last is the length minus 1. A position outside the list stops the script with an error.

SlotTakesWhat it is for
1numberWhich position, counting from 0.
2listThe list to read from.

Gives back: any value

Script: list.get(number)

set item [number] of [list] to [any value]

set item 0 of List to any value

Replaces the item at a position in a list. Positions count from 0. A position outside the list stops the script with an error; use add to grow the list.

SlotTakesWhat it is for
1numberWhich position to replace, counting from 0.
2listThe list to change.
3any valueThe new item.

Script: list.set(number, value)

remove item [number] of [list]

remove item 0 of List

Removes the item at a position in a list, closing the gap. Positions count from 0. A position outside the list stops the script with an error.

SlotTakesWhat it is for
1numberWhich position to remove, counting from 0.
2listThe list to remove from.

Script: list.removeAt(number)

remove [any value] from [list]

remove any value from List

Removes the first item in a list that is equal to the given value. Does nothing if there is none. Numbers match by value, so 2 and 2.0 are the same.

SlotTakesWhat it is for
1any valueThe value to look for and remove.
2listThe list to remove from.

Script: list.remove(value)

length of [list]

length of List

How many items a list holds. An empty list has length 0.

SlotTakesWhat it is for
1listThe list to count.

Gives back: number

Script: list.size()

[list] contains [any value]

List contains any value

Whether a list holds an item equal to the given value. Numbers match by value, so 2 and 2.0 are the same.

SlotTakesWhat it is for
1listThe list to search.
2any valueThe value to look for.

Gives back: true/false

Script: list.contains(value)

position of [any value] in [list]

position of any value in List

The position of the first item in a list equal to the given value, counting from 0, or -1 if it is not there.

SlotTakesWhat it is for
1any valueThe value to look for.
2listThe list to search.

Gives back: number

Script: list.indexOf(value)

clear [list]

clear List

Removes every item from a list, leaving it empty.

SlotTakesWhat it is for
1listThe list to empty.

Script: list.clear()

set [any value] in [map] to [any value]

set any value in Map to any value

Stores a value in a map under a key, replacing whatever was stored under that key before. Number keys match by value, so 1 and 1.0 are the same key. A map holds at most 10,000 keys; adding past that stops the script with an error.

SlotTakesWhat it is for
1any valueThe key to store the value under.
2mapThe map to store into.
3any valueThe value to store.

Script: map.put(value, value)

[any value] in [map]

any value in Map

The value stored in a map under a key, or nothing if the key is not there.

SlotTakesWhat it is for
1any valueThe key to look up.
2mapThe map to read from.

Gives back: any value

Script: map.get(value)

remove [any value] from [map]

remove any value from Map

Removes a key and its value from a map. Does nothing if the key is not there.

SlotTakesWhat it is for
1any valueThe key to remove.
2mapThe map to remove from.

Script: map.remove(value)

[map] has [any value]

Map has any value

Whether a map has a value stored under a key, even if that value is nothing.

SlotTakesWhat it is for
1mapThe map to check.
2any valueThe key to look for.

Gives back: true/false

Script: map.has(value)

keys of [map]

keys of Map

A new list of every key in a map, in the order they were first added. Changing the list does not change the map.

SlotTakesWhat it is for
1mapThe map to list the keys of.

Gives back: list

Script: map.keys()

values of [map]

values of Map

A new list of every value in a map, in the order their keys were first added. Changing the list does not change the map.

SlotTakesWhat it is for
1mapThe map to list the values of.

Gives back: list

Script: map.values()

size of [map]

size of Map

How many keys a map holds. An empty map has size 0.

SlotTakesWhat it is for
1mapThe map to count.

Gives back: number

Script: map.size()

clear [map]

clear Map

Removes every key and value from a map, leaving it empty.

SlotTakesWhat it is for
1mapThe map to empty.

Script: map.clear()

On this page