Skip to content

Messages

By default, a2c build writes its messages as lines of text on standard error. For tools that read them (the application does this too), --message-format json writes one JSON object per line instead:

a2c build MyProject.autoplay2c --message-format json
{"kind":"project","level":"info","text":"MyProject.autoplay: AutoPlay Media Studio 8, 6 scripts into module `myproject` (ams8)"}
{"kind":"warning","level":"warning","text":"MyProject.autoplay[page/Main/OK/On Click]:1:1: warning A2C:L:W:0300: unknown directive `--#cahce`","code":"A2C:L:W:0300","name":"unknown-directive","diagnostic":{"code":"A2C:L:W:0300","severity":"warning","file":"MyProject.autoplay","script":"page/Main/OK/On Click","location":{"line":1,"column":1},"message":"unknown directive `--#cahce`"}}
{"kind":"built","level":"success","text":"built CD_Root\\AutoPlay\\Scripts\\myproject.dll (ams8, lua5.1.dll, native backend)","path":"CD_Root\\AutoPlay\\Scripts\\myproject.dll"}
{"kind":"wrote","level":"info","text":"wrote project to MyProject.a2c.autoplay","path":"MyProject.a2c.autoplay"}
{"kind":"finished","level":"success","text":"build finished"}

Fields

Field Description
kind What happened, see below
level How to show it: info, warning, error or success
text The line the text format prints
code For a warning or an error, its code: A2C:L:W:0300
name The name of that code: unknown-directive
diagnostic For a warning, an error or an optimization about your source: code, severity, file, script (in a project), location (line and column), message and, where the line is known, excerpt: the line's text, the characters before the part it points at (start), that part's length in characters (width, 0 for the whole line), and up to two lines before it (before) and one after it (after). Lines are those of the script, also in a message's text (assigned on line 3); a line in another script is named with it (line 3 of `globals`)
path The file that was written, or the DLL that was built
function For a function message: name, file, script, line, operations (native, guarded and generic), applied, missed, api_calls, helper_calls and instructions
summary For a summary message: functions, operations, applied and missed
Kind Meaning
project A project was read and its scripts translated
serialized Objects were serialized
warning A warning
function A function of your code and how much of it is native, from the compilation log
optimization An optimization applied or missed, with its code, name and diagnostic
summary The compilation log of the whole module
compiler A line printed by tcc (C backend only)
output An output was written to standard output
wrote A file was written
built The DLL was built
error An error that stopped the build. A build stopped by several errors (such as syntax errors in several scripts) gives one message for each.
finished The last message of every build, with level success or error

A build that ends without a finished message stopped abnormally. The exit status always agrees with the finished message, 0 for success and 1 for error.

Outputs you send to standard output with --emit kind=- still go there, only the messages are JSON.

Note

Messages may gain fields in later versions of autoplay2c, so make sure your tool ignores the fields it doesn't know.