Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

PrintJson: Difference between revisions

From FiguraMC
PenguinEncounter (talk | contribs)
Created page with "{{lowercase}} {| class="wikitable" ! Arguments ! Returns |- | {{type|string...}} | {{Type|string}} |} Displays any amount of arguments without separators or the <code>[lua]</code> prefix. The return value is the displayed text without the formatting. If an argument is a {{type|string}}, it is interpreted as a [https://minecraft.wiki/w/Raw_JSON_text_format JSON text component], or if that fails, the string is displayed directly. All other types are displayed using [https..."
Tag: 2017 source edit
 
PenguinEncounter (talk | contribs)
m add 'aliases'
Tag: 2017 source edit
 
Line 1: Line 1:
{{lowercase}}
{{lowercase}}
{{aliases|logJson}}
{| class="wikitable"
{| class="wikitable"
! Arguments
! Arguments

Latest revision as of 06:49, 25 October 2024

Aliases: logJson

Arguments Returns
string... string

Displays any amount of arguments without separators or the [lua] prefix. The return value is the displayed text without the formatting. If an argument is a string, it is interpreted as a JSON text component, or if that fails, the string is displayed directly. All other types are displayed using tostring.

Example

-- Displays "Hello, world!" in green
printJson [[{"text": "Hello, world!", "color": "green"}]]
-- Displays the name of the avatar in gold (example of dynamic text)
printJson(toJson {
    text = avatar:getName(),
    color = "gold"
})

See also