autoplay2c

Description

autoplay2c compiles Lua into native Lua module DLLs. When you give it an AutoPlay Media Studio project, it compiles every script in that project into one module and writes a copy of the project in which each script is a single call into that module. This way, the application you publish doesn't carry any Lua source at all, because your code is now machine code in a DLL.

Downloads for version 2.0.0-beta (latest)

Changelog »

Windows

beta

x64

Supported Hosts

The hosts in this table describe which architecture and Lua version are supported by autoplay2c on Windows. The reason why Indigorose Software products are mentioned, is because the native code generation and optimizations are tuned to those Lua builds specifically, but you can also just use the ams8 target to build for 32-bit Lua 5.1 on Windows.

Host Lua Architecture Target name
AutoPlay Media Studio 8 5.1 32-bit ams8
AutoPlay Media Studio 9 5.3 32-bit ams9
Setup Factory 9.7 5.1 32-bit suf9-x86
Setup Factory 9.7 5.1 64-bit suf9-x64
Setup Factory 10 5.3 32-bit suf10-x86
Setup Factory 10 5.3 64-bit suf10-x64

Features

  • Your scripts are compiled into machine code. There's no Lua source or bytecode left in your published application that could be turned back into your code.
  • A compiled script prints, returns and raises exactly what the interpreter would. Every change to the compiler is tested against the real Lua DLLs of each host, and the few differences that remain are listed in Limitations.
  • Code that computes with numbers often runs several times faster than in the interpreter. Read more in Optimizations.
  • You can build from the desktop application or from the command line. Both build the same way and produce the same files.
  • autoplay2c runs on Windows, Linux and macOS. What it makes is always a Windows DLL, and it doesn't need any other tools to make it.

A Short Example

Let's say your project has a button with this On Click script:

local name = Input.GetText("Name");
Dialog.Message("Hello", "Hello " .. name .. "!");

After a build, the rewritten project has this as the button's On Click script:

core.f4(this);

The original code now lives in CD_Root\AutoPlay\Scripts\core.dll, which the project's global script loads once. You open the rewritten project in AutoPlay Media Studio and publish it just like you always do. Read more in AutoPlay Projects.

Where to Go Next

  • Getting Started: install autoplay2c and build your first project or module.
  • AutoPlay Projects: what happens to a project, and what changes for it.
  • Lua Modules: plain modules for Setup Factory and other hosts.
  • Directives: comments that let you trade a little flexibility for speed.
  • Limitations: what compiled code can't do. Make sure to read this before your first release!