2026-03-03 12:00:16 +01:00
# License notice
All third party licenses can be found in the module resources/license folder
Project license is in LICENSE-File
2026-03-03 10:55:46 +01:00
# LuaJ
2008-12-03 01:41:21 +00:00
2026-03-03 10:55:46 +01:00
LuaJ is a Java implementation of Lua with JSE and JME targets.
2008-12-03 01:41:21 +00:00
2026-03-03 11:48:26 +01:00
This fork is maintained by Open Autonomous Connection and is built with Maven only. The current codebase targets Lua 5.5 semantics in the supported runtime paths, including `global` , named vararg tables, read-only `for` variables, `table.create` , updated `utf8.offset` , binary chunk compatibility, and the existing Lua 5.4 `<close>` and `<const>` behavior.
2008-12-03 01:41:21 +00:00
2026-03-03 10:55:46 +01:00
## Modules
2009-10-27 06:12:24 +00:00
2026-03-03 10:55:46 +01:00
- `core` : VM, compiler, standard runtime pieces
- `jse` : Java SE platform, JSR-223 integration, LuaJC support
- `jme` : Java ME platform support
2010-03-31 04:49:01 +00:00
2026-03-03 10:55:46 +01:00
## Requirements
2010-03-31 04:49:01 +00:00
2026-03-03 10:55:46 +01:00
- Java 25
- Maven 3.9+
2010-08-15 20:15:56 +00:00
2026-03-03 10:55:46 +01:00
The repository includes a Maven Wrapper:
2010-08-15 03:56:03 +00:00
2026-03-03 10:55:46 +01:00
- Windows: `mvnw.cmd`
- Unix-like shells: `./mvnw`
2008-12-03 01:41:21 +00:00
2026-03-03 10:55:46 +01:00
## Build
2008-12-03 01:41:21 +00:00
2026-03-03 10:55:46 +01:00
Build all modules:
2008-12-03 01:41:21 +00:00
2026-03-03 10:55:46 +01:00
```powershell
.\mvnw.cmd clean package
```
2008-12-03 01:41:21 +00:00
2026-03-03 10:55:46 +01:00
Run the full test suite:
2008-12-03 01:41:21 +00:00
2026-03-03 10:55:46 +01:00
```powershell
.\mvnw.cmd clean test
```
2012-02-01 06:04:51 +00:00
2026-03-03 10:55:46 +01:00
Build a single module with dependencies:
2012-02-01 06:04:51 +00:00
2026-03-03 10:55:46 +01:00
```powershell
.\mvnw.cmd -pl jse -am package
```
2014-04-28 23:54:03 +00:00
2026-03-03 10:55:46 +01:00
## Quick Start
2008-12-03 01:41:21 +00:00
2026-03-03 10:55:46 +01:00
Minimal JSE embedding example:
2008-12-03 01:41:21 +00:00
2026-03-03 10:55:46 +01:00
```java
import org.luaj.vm2.Globals;
2013-01-21 21:37:44 +00:00
import org.luaj.vm2.LuaValue;
2026-03-03 10:55:46 +01:00
import org.luaj.vm2.libs.jse.JsePlatform;
2010-05-09 05:36:03 +00:00
2026-03-03 10:55:46 +01:00
Globals globals = JsePlatform.standardGlobals();
LuaValue chunk = globals.load("print('hello, world')");
chunk.call();
```
2009-04-23 04:57:47 +00:00
2026-03-03 10:55:46 +01:00
## Maven Usage
2009-04-23 04:57:47 +00:00
2026-03-03 10:55:46 +01:00
Use the published modules directly from Maven:
2009-04-23 04:57:47 +00:00
2026-03-03 10:55:46 +01:00
```xml
<dependency>
<groupId>org.openautonomousconnection.luaj</groupId>
<artifactId>jse</artifactId>
<version>3.0.2</version>
</dependency>
```
2009-08-25 20:46:07 +00:00
2026-03-03 10:55:46 +01:00
For the core VM without the JSE platform layer:
2013-01-21 21:37:44 +00:00
2026-03-03 10:55:46 +01:00
```xml
<dependency>
<groupId>org.openautonomousconnection.luaj</groupId>
<artifactId>core</artifactId>
<version>3.0.2</version>
</dependency>
```
2013-01-21 21:37:44 +00:00
2026-03-03 10:55:46 +01:00
## Notable Runtime Notes
2013-01-21 21:37:44 +00:00
2026-03-03 10:55:46 +01:00
- LuaJ runs on the host JVM garbage collector. Resource cleanup is not equivalent to native Lua finalization.
- Explicit close is still the correct pattern for files, iterators, and host-backed resources.
2026-03-03 11:48:26 +01:00
- `LuaJC` is available on JSE and covered by the current Maven test path. For 5.5-only constructs that the legacy bytecode generator does not model directly, it falls back to generated delegate wrappers over `LuaClosure` .
2026-03-03 10:55:46 +01:00
- JME support remains in the Maven build, with environment-specific limitations depending on available Java ME APIs.
2026-03-03 11:48:26 +01:00
- The repository currently passes `.\mvnw.cmd -q clean test` .
2013-01-21 21:37:44 +00:00
2026-03-03 10:55:46 +01:00
## Examples
2014-01-02 15:55:36 +00:00
2026-03-03 10:55:46 +01:00
Relevant examples are in:
2014-10-27 13:52:26 +00:00
2026-03-03 10:55:46 +01:00
- `examples/jse`
- `examples/jme`
- `examples/lua`
- `examples/maven`
2018-09-13 11:53:00 +02:00
2026-03-03 10:55:46 +01:00
## License
2010-03-31 04:49:01 +00:00
2026-03-03 10:55:46 +01:00
This project is distributed under the terms in `LICENSE` .