What is LuaJava?
This is yet another fork of the original LuaJava.
LuaJava is a scripting tool for Java. The goal of this tool is to allow scripts written in Lua to manipulate components developed in Java. LuaJava allows Java components to be accessed from Lua using the same syntax that is used for accessing Lua's native objects, without any need for declarations or any kind of preprocessing.
LuaJava also allows any Java interface to get implemented in Lua and passed as parameter to any method, and when called, the equivalent function will be called in Lua, the result passed back to Java.
LuaJava is available under the same license as Lua 5.1, that is, it can be used at no cost for both academic and commercial purposes.
TIP
Try it out with a pre-built console!
Prerequisites
This library includes two sets of Java API:
A thin wrapper around the Lua C API. So you will need some basic understanding of the Lua C API. Most API names are renamed in CamelCases with the
lua_
orluaL_
prefix removed.Additionally, if you are not satisfied with the API (which is an intersection between Lua 5.* versions), you can use the Lua C API bindings directly via
Lua#getLuaNatives
.A more Java-ish API. This requires significantly less Lua knowledge. See Java API.
Supported Lua Versions
Supported Lua versions are: Lua 5.1, Lua 5.2, Lua 5.3, Lua 5.4, LuaJ and LuaJIT.
I try to keep up with the most recent version of Lua, that is, the latest official release of Lua, and the tip of the v2.1 branch of LuaJIT [1] as well as the tip of a LuaJ fork that has no official release yet. Currently:
Platforms
Thanks to jnigen, we have built Lua natives for almost all common platforms, readily available on Maven Central. [2] [3]
- Available and tested
- Native available but not thoroughly tested yet
- Not available (yet!)
Lua 5.1 | Lua 5.2 | Lua 5.3 | Lua 5.4 | LuaJIT | LuaJ | |
---|---|---|---|---|---|---|
Linux (x86_64) | ||||||
Linux (x86) | ||||||
Linux (ARM) | ||||||
Linux (ARM64) | ||||||
Windows (x86) | ||||||
Windows (x86_64) | ||||||
MacOS (x86_64) | ||||||
MacOS (ARM64) | ||||||
Android [2] | ||||||
iOS |
LuaJIT no longer creates new releases. See Project status · Issue #665 for an explanation. ↩︎
Android is available on many platforms, and we provide natives for
armeabi-v7a
arm64-v8a
x86
x86_64
. It is tested against API levels 21, 24, 27, 30 and 33 onx86_64
architectures (and onx86
if adefault
emulator image is available) (and against my own phone of API level 30 onarm64-v8a
). ↩︎Since LuaJ is written in Java, it should theoretically run on all platforms that supports Java. ↩︎