Skip to content

The Application

autoplay2c is the desktop application. You set up a build in it, save it as a project file, and build with one click. It runs on Windows, Linux and macOS.

The Window

Part What it does
Top bar The project's name, Open, Save, the menu, and Build (or Stop while a build runs)
Sidebar The four pages: Project, Version, Objects and Compiler
Page The settings of the page you selected. Read more in The Pages.
Log, Messages and Functions Three tabs under the page. Log shows the build's progress, warnings and errors. Messages shows its errors, warnings and optimizations, and Functions what became of each function.
Status bar What happened last, such as Saved MyProject.autoplay2c or Build finished

Empty fields show the value a build will use in grey, so you only fill in what you want to be different.

Building

Click Build or press Ctrl+B. The application first checks that it has what a build needs (an input, and a target for a Lua file), then runs the build and shows its messages in the log as they come in. Stop ends a build that's still running. When a build fails with errors, the application switches to the Messages tab.

The application doesn't compile anything itself. It runs the a2c command line next to it, with the settings you see on screen. This means that a build in the application and a build of the same project file on the command line make exactly the same files, with exactly the same messages.

Note

You don't have to save before you build. The build uses what's on screen, saved or not.

The Build Log

Each line in the log is coloured by what it is: information, a warning, an error or success. Warnings and errors name the file, the script and the line they're about (see Diagnostics). You can copy a single line, copy the whole log, or clear it.

The log leaves out the optimizations and the functions, which can run into the thousands for a large project. You find those on the Messages and Functions tabs.

The Messages Tab

The Messages tab shows every error, warning and optimization of the last build. Its title counts the errors (in red) and the warnings (in amber).

Counts

The line at the top sums up the build:

Count What it counts
errors What stopped the build
warnings What may not do what you expect
applied The optimizations the compiler applied
missed The optimizations it considered and couldn't apply, each with the reason

Click a count to hide that kind; it is struck through until you click it again. At the right, a bar shows how much of the module's operations became native code.

Messages

The messages are grouped by script (or by file, for a Lua file). Each row shows the line and column, the kind, the message and the code. To narrow the list:

  • Click the counts to hide kinds.
  • Use All parts to show the messages of one part of the compiler, such as IR or Lua (L).
  • Type in the search field to find a code, a name, a place or any text in the message.

Click a row to open it. An open row says what the message means and shows the lines of your source it is about, highlighted, with the part it points at underlined. Line numbers are those of the script, as you see them in AutoPlay:

12 │ function deposit(amount)
13 │     local sum = 0
14 │     t = tostring(amount)
   │     ^
15 │     return sum + 1.5, t

Click the row again, or another row, to close it.

Right-click a row to copy its place, its code or its whole line. Don't report this adds a warning or an optimization to the project's list of what isn't reported, which you find on the Compiler page; errors can't be left out. Read more in Silencing. Hover over a code to see its name and what it means. When the user documentation is installed, click a code to open its section, which explains the message and what you can do about it.

The Functions Tab

The Functions tab lists the Lua functions of the module, one per row:

Column What it shows
Function The name, such as Account:deposit. A whole script shows as the script's name.
Script The script it is in, or the file for a Lua file
Line The line it starts on
Native How much of it became native code, as a bar and a percentage
Applied The optimizations applied in it
Missed The optimizations missed in it
API calls The calls into the host's Lua it still makes

The least native functions come first, since that's where a change helps most. Click a column's header to sort by it, and click it again to reverse the order. Click a function to open it and see its optimizations by line, laid out as on the Messages tab; click one to open it to its source, as on the Messages tab. The search field finds functions by name or script.

A function is named as your source names it: Account:deposit, or for a function stored in a table or a variable, where it is stored, such as ops.add or handlers[1]. A function with no name (one passed to a call, or returned) is named f and the line it starts on, such as f12.

A build that fails before it compiles has no functions, so the tab stays empty.

Always On

Some optimizations are always applied, such as reading t.name without pushing the key. The application leaves them out, so the list shows what the compiler decided. Tick Always on to include them too. This takes effect at the next build.

Project Files

Action Shortcut
New Ctrl+N
Open Ctrl+O
Save Ctrl+S
Save As Ctrl+Shift+S
Build Ctrl+B

On macOS, use Cmd instead of Ctrl.

You can also drop files on the window. A project file opens, while an AutoPlay project or a Lua file becomes the input. When you installed autoplay2c with the installer, a project file you double-click opens in the application. You can also give one on the command line:

autoplay2c MyProject.autoplay2c

Saving writes paths relative to the project file, so you can move a project folder (or check it in to version control) without breaking it.

Graphics

The application draws its window with your graphics card. On a computer without one, such as a virtual machine without 3D acceleration, it draws on the processor instead, which is faster there than the software graphics card Windows offers. About in the menu tells you which is used.

You can change how the window draws with environment variables. Set them before you start the application, for example in a command prompt:

set ICED_PRESENT_MODE=vsync
autoplay2c
Variable What it does
ICED_BACKEND tiny-skia always draws on the processor, wgpu always on the graphics card. Without it, the application chooses.
WGPU_BACKEND The graphics interfaces the application may use: vulkan, dx12, metal or gl, or several separated by commas. Without it, it uses the first that offers a graphics card, in that order.
ICED_PRESENT_MODE When a drawn frame reaches the screen. On Windows the application uses no_vsync, which shows frames at once, because waiting for the screen's refresh makes the window open about 0.15 seconds later. Set vsync if you see tearing while you scroll or resize the window.
VK_LOADER_LAYERS_DISABLE On Windows the application leaves out the Vulkan layers that overlays (Steam, OBS, RivaTuner and others) add to every program, because they slow down its start. Set it to none to load them, for example to let an overlay or OBS's game capture see the window.

The last two are set by the application only when you haven't set them yourself. The compiler that the application starts for a build never gets any of these variables.

Warning

ICED_PRESENT_MODE=mailbox also avoids tearing, but not every graphics driver supports it, and where it doesn't the application can't open its window.

Themes

The application follows your system's light or dark theme. You can choose another one in the menu: System theme, Light theme or Dark theme.

Technical details
  • A build writes the settings to a temporary project file and runs a2c build <file> --message-format json --diagnostics applied in a process of its own, so a crash of the compiler can't take the window down. With Always on ticked, the level is all. This level replaces the project file's Diagnostics setting for builds in the application. Read more in Messages.
  • Codes link to their section of this documentation on imagine-libs.org, the copy for the application's own version. Documentation and Changelog in the menu open it there too. Hovering over a code shows what it means without going online.
  • The application uses the a2c in its own folder. Set the environment variable A2C_CLI to the path of another a2c to use that one instead. Its version must match the application's.