M MY Multiplayer: Wiki
Side
Kind

split

Shared

Splits a text into pieces at the separators.

table split(string text, string|int separator)

Parameters

NameTypeDescription
textstringThe text. Only up to its first null byte counts.
separatorstring|intThe characters that separate, or a character's code.

Returns

A list with the pieces. Empty pieces are left out.

Example

local parts = split("2495.1,-1687.4,14.5", ",")
local x, y, z = tonumber(parts[1]), tonumber(parts[2]), tonumber(parts[3])
NoteEach character of the separator splits on its own: split("a, b", ", ") cuts at the comma and at the space.

See also