Skip to content

simple

The simple library wraps register() and the format library into one concise function.

local registerSimple = require "simple"

registerSimple(cmd, args, template, range?, overlay?)

Section titled “registerSimple(cmd, args, template, range?, overlay?)”
ParamTypeDescription
cmdstringCommand syntax string
argstableTable mapping argument names to types
templatestringFormat string passed to format
rangenumber?If > 0, uses world:broadcastInRange instead of global broadcast
overlaybool|number?If true, sends as title overlay. If a number, acts as both range and overlay flag

The p variable is automatically set to ctx.player.

Broadcast a message when a player throws a fireball (global chat):

registerSimple("throw <target:player>", {target = "player"},
"*{p.name} throws a fireball at {t.name}*")

Broadcast in range (50 blocks):

registerSimple("yell <message:text>", {message = "text"},
"{p.name} yells: {m}", 50)

As a title overlay:

registerSimple("announce <message:text>", {message = "text"},
"{m}", true)

With range and overlay:

registerSimple("localmsg <message:text>", {message = "text"},
"{m}", 50, true)