Skip to content
Li, Xizhi edited this page Apr 12, 2017 · 6 revisions

Deploy Your Application

You can deploy your application to windows, linux, ios, android, etc. Both 32bits/64bits versions are supported.

  • NPL scripts can be deployed in plain *.lua or *.npl text files or in precompiled *.o binary file.
  • You can also buddle all or part of your scripts or any other read-only resource files into one or more zipped archive files.
  • You can deploy NPL runtime globally or side-by-side with your application files.

For automatic deployment, please install and use ParacraftSDK. This articles explains how to do it manually.

Pre-compiling NPL script

Precompiled NPL script is called bytecode in lua. The bytecode generated by Luajit is incompatible with bytecode generated by lua, but is cross-platform for any (32bits/64bits) architecture. If you choose to deploy your app with bytecode, you must also choose to use luajit or lua when deploying NPL runtime.

Please read the documentation in NPLCompiler.lua for more information. Examples:

NPL.load("(gl)script/ide/Debugger/NPLCompiler.lua");
NPL.CompileFiles("script/*.lua", nil, 100);

Buddle Scripts in Zip files

You can bundle your script and assets in zip files and distribute them as one or more package file. see PKGFiles for details.

Deploy NPLRuntime Side-By-Side

Deploying NPL Runtime side-by-side is as easy as copying all executable files to the application directory. The recommended deployment folder structures is below

bin/: npl exe, dll, lua,luajit, etc
packages/: common *.pkg *.zip package files
script/: your own script files
config.txt
any other files

Another way is to deploy everything to the application root directory.

script/: your own script files
npl exe, dll, lua,luajit, etc
common *.pkg *.zip package files
config.txt
any other files

if config.txt file is on the root application directory. Its cmdline content will be appended to NPL command line when running NPL runtime from this directory.

An example config.txt, see below:

cmdline=noupdate="true" debug="main" bootstrapper="script/apps/HelloWorld/main.lua"

Luajit vs Lua

Luajit and Lua are ABI-compatible, meaning that you can deploy NPL runtime with them simply by replacing lua.dll(so) with either implementation. Luajit is the recommended way for release deployment on all platforms. However, currently on iOS, Luajit is used but disabled, since it is not allowed. Even a disabled luajit runs faster than lua and its bytecode is the same for both 32bits and 64bits OS. So you would only want to deploy lua dll for debugging purposes on development machines.

Clone this wiki locally