M MY Multiplayer: Wiki
Side
Kind

sendDuiMessage

Client

Sends a message to a dui's page. The page receives it in the window's message event.

bool sendDuiMessage(dui dui, table|string message)

Parameters

NameTypeDescription
duiduiThe dui.
messagetable|stringA table, sent as JSON, or a string already in JSON.

Returns

true if the message was sent. false with a wrong argument (logs a warning).

A message sent before the page has loaded waits and is delivered once it loads.

Example

local dui = createDui("https://example.com/scoreboard.html", 512, 512)
sendDuiMessage(dui, { type = "score", team = "grove", points = 12 })
NoteA string reaches the page exactly as written, so it must be valid JSON.

See also