What is LuaJava?

Hello World Example

Build Statusopen in new windowLicense: MITopen in new windowCodecovopen in new windowJava 8open in new windowSonatype Nexus (Snapshots)open in new windowMaven Centralopen in new window

Build Statusopen in new windowDocument Versionopen in new window

Tests: macOS on M1open in new windowTests: Linux on arm64open in new window

This is yet another fork of the original LuaJavaopen in new window.

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

The Java API of this library is a thin wrapper around the Lua C API. So you will need some basic understanding of the Lua C APIopen in new window. Most API names are renamed in CamelCases with the lua_ or luaL_ prefix removed.

Supported Lua Versions

Supported Lua versions are: Lua 5.1, Lua 5.2, Lua 5.3, Lua 5.4 and LuaJIT.

I try to keep up with the most recent version of Lua, that is, the latest official release of Luaopen in new window, and the tip of the v2.1 branch of LuaJITopen in new window.[1] Currently:

Lua 5.1Lua 5.2Lua 5.3Lua 5.4LuaJITLuaJ
5.1.55.2.45.3.65.4.60d313b2open in new windowA forkopen in new window

Platforms

Thanks to jnigenopen in new window, we have built Lua natives for almost all common platforms, readily available on Maven Centralopen in new window. [2] [3]

  • Available and tested
  • Native available but not thoroughly tested yet
  • Not available (yet!)
Lua 5.1Lua 5.2Lua 5.3Lua 5.4LuaJITLuaJ
Linux (x86_64)
Linux (x86)
Linux (ARM)
Linux (ARM64)
Windows (x86)
Windows (x86_64)
MacOS (x86_64)
MacOS (ARM64)
Android [2]
iOS

  1. LuaJIT no longer creates new releases. See Project status · Issue #665open in new window for an explanation. ↩︎

  2. 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 on x86_64 architectures (and on x86 if a default emulator image is available) (and against my own phone of API level 30 on arm64-v8a). ↩︎

  3. Since LuaJ is written in Java, it should theoretically run on all platforms that supports Java. ↩︎