Maintained ToLua runtime for Unity games using ToLua.
- Mainly to update outdated libraries.
- Upgrade build script or toolchains for each platforms.
CMake 3.14+ is required to build tolua and cross-compiling.
| Windows (MSYS2) | Windows | macOS | Linux | |
|---|---|---|---|---|
| Windows (x86) | ✔️ | ✔️ (msvc) | ❌ | ❌ |
| Windows (x64) | ✔️ | ✔️ (msvc) | ❌ | ❌ |
| Windows (arm64) | ❌ | ✔️ (msvc) | ❌ | ❌ |
| Android (arm) | ✔️ | ❌ | ❌ | ❌ |
| Android (arm64) | ✔️ | ✔️ (gcc) | ✔️ | ✔️ |
| macOS (universal) | ❌ | ❌ | ✔️ | ❌ |
| macOS (arm64) | ❌ | ❌ | ✔️ | ❌ |
| macOS (x64) | ❌ | ❌ | ✔️ | ❌ |
| iOS (arm64) | ❌ | ❌ | ✔️ | ❌ |
NOTE: Every predefiend build script would install the target library to Plugins folder, which could be placed on any subfolder in Assets, according to the disccusion for newer version of Unity.
When targeting Windows, MINGW is preferred over MSVC (luajit options not supported).
Visual Studio 2017+ should work (Tested for Visual Studio 2022)
> .\build_tolua_windows_x86.bat
> .\build_tolua_windows_x64.bat
> .\build_tolua_windows_arm64.batIMPORTANT: Symbols from LuaJIT is stuck for exporting to shared library now. Refer to #1341 for any progress.
Install MSYS2 and prepare MSYS2 environment and toolchains.
$ pacman -S git
$ pacman -S make
$ # For x86
$ pacman -S mingw-w64-i686-cmake
$ pacman -S mingw-w64-i686-gcc
$ # For x86_64
$ pacman -S mingw-w64-x86_64-cmake
$ pacman -S mingw-w64-x86_64-gccTo build, symply run:
$ ./build_tolua_windows_mingw.shTo build for Android, you need to install the Android NDK and Ninja.
The default ANDROID_NATIVE_API_LEVEL is set to 21.
Set environment variable ANDROID_NDK_HOME to the path of the NDK,
e.g. export ANDROID_NDK_HOME=/path/to/android-ndk-r27c on UNIX-like systems, or
pass -DANDROID_NDK=/path/to/android-ndk-r27c to CMake command.
Using Scoop or other package managers to install gcc.
> set ANDROID_NDK_HOME=C:\path\to\android-ndk-r27c && .\build_tolua_android_arm64.batFor MinGW, it is the same as build on UNIX-like system.
$ ANDROID_NDK_HOME=C:/path/to/android-ndk-r27c ./build_tolua_android_arm64.sh
$ ANDROID_NDK_HOME=C:/path/to/android-ndk-r27c ./build_tolua_android_arm.sh$ ANDROID_NDK_HOME=/path/to/android-ndk-r27c ./build_tolua_android_arm64.sh
$ ANDROID_NDK_HOME=/path/to/android-ndk-r27c ./build_tolua_android_arm.shXcode is needed for macOS. The default DEPLOYMENT_TARGET is set to 11.0.
$ ./build_tolua_osx_universal.sh
$ ./build_tolua_osx_arm64.sh
$ ./build_tolua_osx_x64.shXcode is needed to build for iOS. The default DEPLOYMENT_TARGET is set to 13.0.
$ ./build_tolua_ios_arm64.shLuaJIT is updated to (current) latest v2.1 branch (commit at 2025-01-13 16:22:22), but currently using a forked repository.
| Version | Notes | |
|---|---|---|
| openresty/lua-cjson | v2.1.0.14 | Moved from mpx/lua-cjson |
| lunarmodules/luasocket | v3.1.0 | original v3.0-rc1 |
| topameng/protoc-gen-lua | ||
| struct | v1.8 | original v1.4 |
| alex4814/lpeg-luajit | v1.1.0 | original v0.10 |