autoplay2c
Compile your AutoPlay Media Studio projects and Lua scripts into native Lua modules, so the application you publish carries machine code instead of source.
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.
You can also give it a single Lua file, which then becomes a module DLL that you load with
require. That's how you use autoplay2c with Setup Factory, or with any other application that
runs one of the supported Lua DLLs.
No source left behind¶
Your scripts become machine code. There's no Lua source or bytecode in your published application that could be turned back into your code.
Behaves like Lua¶
A compiled script prints, returns and raises exactly what the interpreter would. The few differences are listed in Limitations.
Often much faster¶
Code that computes with numbers often runs several times faster than in the interpreter. Read more in Optimizations.
Application or command line¶
Build from the desktop application or the command line. Both build the same way and make the same files.
Its own compiler¶
autoplay2c has its own Lua compiler and code generator. It doesn't need any other tools to make a DLL.
Four hosts¶
AutoPlay Media Studio 8 and 9, and Setup Factory 9.7 and 10, in 32-bit and 64-bit where the host has them. See the table below.
This version of autoplay2c replaces the previous one. It's written from the ground up, and it supports more hosts than the previous version did. If you've used autoplay2c before, read Coming From the Previous Version.
Supported Hosts¶
| 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 |
AutoPlay projects are compiled and rewritten as a whole, while Setup Factory is supported through plain Lua modules. Read more in Targets.
A Short Example¶
Let's say your project has a button with this On Click script:
After a build, the rewritten project has this as the button's On Click script:
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.
Before your first release
Make sure to read Limitations: it lists what compiled code can't do.