Skip to contents

Checks a character description against format version 1 and the package's limits on input, drawing and capabilities. It never repairs or recolours anything. To change a character, edit the JSON or the plain list and check it again; a checked object cannot be opened or edited.

Usage

mascot_check_character(x)

Arguments

x

A JSON string, a parsed plain list, or checked mascot_character_data. A string always means JSON, never a path or id. NULL is not accepted.

Value

A checked, resolved, self-contained mascot_character_data object, visibly. Its fields are internal implementation details.

Details

Content problems inherit mascot_error_character and mascot_error, with code, path, value and fix. Argument problems inherit mascot_error_argument and mascot_error, with argument, code and value. Every character needs wave and nod tracks that change something. wave must change a channel of a part other than root; nod may change any channel, including root. A checked object is not stored anywhere, so pass it each time you use it. The format version, the set of supported capabilities and the version of the input and drawing limits can each change on their own. Built-in character ids are reserved and refused here, so give your character its own id before checking it.

Experimental

Experimental Its arguments, results and diagnostics may change in a later release.

Examples

path <- system.file("examples", "characters", "study_bot.json", package = "mascot")
source <- jsonlite::read_json(path)
bot <- mascot_check_character(source)