Guide 1 Docs 2 Reference 3
11

network global

An experience made of more than one server: asks for instances of its members and is told about them. A failed call answers nil and a reason. Calls yield, but for status. Without a network every answer is no.

Docs: Data

Functions 11

network.start(options: {member: string, label: string, slots: number, data: any}) → (NetworkStarted?, string?)

Starts an instance of member. Answers at once; it is online later.

network.find(options: {label: string, players: number?, party: (Player | string)?, start: {member: string, slots: number, data: any}?}) → (NetworkStarted?, string?)

The instance to send players players to (1 unless set), or nil when none has room. With start, one is started when none has room.

network.stop(id: string) → (boolean, string?)

Stops an instance of this network.

network.info() → ({network: string, id: string?, member: string?, label: string?, slots: number?, data: any}?, string?)

This server's network, by name, and the instance this pack runs on: id and the fields after it are nil on a server that is not one.

network.status(options: {open: number, status: string?, meta: any})

Says where this instance is. At most one a second is sent: the first at once, then the last of those that came after.

network.on_instance_start(handler: (instance: NetworkInstance) -> ()) → Connection

Called when an instance is first seen: started, or already running.

network.on_instance_change(handler: (instance: NetworkInstance) -> ()) → Connection

Called when an instance's state, open, status or meta changes.

network.on_instance_stop(handler: (id: string) -> ()) → Connection

Called with the id of an instance that is gone.

network.online(label: string?) → (number?, string?)

How many play on this network (everyone on Minefort on the platform's hub), or in one mode's games. An answer is kept for 5 seconds.

network.browse(view: "search" | "for-you" | "recent" | "featured", options: {player: (Player | string)?, query: string?, page: number?, category: string?, online: boolean?, ids: {string}?, sort: ("players" | "name")?, also: {recent: boolean?, favorites: {string}?}?}?) → ({BrowseEntry}?, (number | string)?, {recent: {rows: {BrowseEntry}, total: number} | false | nil, favorites: {rows: {BrowseEntry}, total: number} | false | nil}?)

The platform's hub finding every network, in the order to show them. nil and why on a refusal, and anywhere but that hub. One page of 6 rows (page from 1), and how many there are in all; nil and why on a refusal.

network.instances(label: string?) → ({BrowseEntry | NetworkInstance}?, string?)

Everything this network runs: this experience's own always-on servers (on the platform's hub, the hubs), then its games started on demand. With label, only that mode's games.