Skip to content

Emoji

System · Emoji · server and client scripts

Emoji looks up the built-in emojis by shortcode, picker category, and search words. A shortcode is an emoji's lowercase name without colons, such as "+1" or "pirate_flag".

Categories

Function
Categories() -> {{Id: string, Name: string, Count: number}}

Categories returns the picker categories in display order, each with Id, Name, and Count. The first, "frequent", is empty; fill it from the player's picks or from FrequentDefaults.

Example

-- Client script.
for _, category in Emoji.Categories() do
    print(category.Id .. ": " .. category.Count) -- first prints "frequent: 0"
end

CategoryAt

Function
CategoryAt(category: string, index: number) -> string?

CategoryAt returns the shortcode at a 1-based position in a named category, or nil past the end of the category.

Example

-- Client script: list the first ten emojis of "people".
for i = 1, 10 do
    print(Emoji.CategoryAt("people", i)) -- first prints "grinning"
end

FrequentDefaults

Function
FrequentDefaults() -> {string}

FrequentDefaults returns the eight shortcodes the frequently used category shows before the player picks any emoji.

Example

-- Client script.
local defaults = Emoji.FrequentDefaults()
print(#defaults .. " defaults, first " .. defaults[1]) -- prints "8 defaults, first +1"

Info

Function
Info(id: string, skinTone: string?) -> {Glyph: string, Name: string, HasTones: boolean}?

Info returns a table with Glyph, Name, and HasTones for an emoji in an optional skin tone, or nil for an unknown shortcode.

Example

-- Client script.
local info = Emoji.Info("heart_eyes")
if info then
    print(info.Name) -- prints "Smiling Face with Heart-Eyes"
end
Function
Search(query: string, limit: number?) -> {string}

Search returns up to limit shortcodes, 90 by default, of emojis where each word of the query starts a word in the name or keywords, best match first.

Example

-- Client script: autocomplete for a chat box.
local hits = Emoji.Search("cat face", 5)
print(hits[1]) -- prints "cat"