Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename project to luava
Browse files Browse the repository at this point in the history
kaklakariada committed Sep 22, 2024
1 parent dacae69 commit 9195064
Showing 15 changed files with 39 additions and 35 deletions.
6 changes: 5 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -27,5 +27,9 @@
"search.exclude": {
"build/generated/jextract": false,
},
"java.compile.nullAnalysis.mode": "automatic"
"java.compile.nullAnalysis.mode": "automatic",
"sonarlint.connectedMode.project": {
"connectionId": "kaklakariada-github",
"projectKey": "luava"
}
}
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# java-lua
# luava

An experimental Java library for embedding a Lua VM.

[![Build](https://github.com/kaklakariada/java-lua/actions/workflows/build.yml/badge.svg)](https://github.com/kaklakariada/java-lua/actions/workflows/build.yml)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=jlua&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=jlua)
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=jlua&metric=bugs)](https://sonarcloud.io/summary/new_code?id=jlua)
[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=jlua&metric=code_smells)](https://sonarcloud.io/summary/new_code?id=jlua)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=jlua&metric=coverage)](https://sonarcloud.io/summary/new_code?id=jlua)
[![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=jlua&metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=jlua)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=luava&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=luava)
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=luava&metric=bugs)](https://sonarcloud.io/summary/new_code?id=luava)
[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=luava&metric=code_smells)](https://sonarcloud.io/summary/new_code?id=luava)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=luava&metric=coverage)](https://sonarcloud.io/summary/new_code?id=luava)
[![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=luava&metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=luava)

## Development

7 changes: 5 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -5,6 +5,9 @@ plugins {
id "org.sonarqube" version "5.1.0.4882"
}

version = '0.0.1'
group = 'org.itsallcode'

repositories {
mavenCentral()
}
@@ -24,7 +27,7 @@ java {
javadoc {
enabled = true
failOnError = true
excludes = ["org/itsallcode/jlua/ffi/**"]
excludes = ["org/itsallcode/luava/ffi/**"]
options.addBooleanOption('html5', true)
options.addStringOption('Xwerror', '-quiet')
}
@@ -138,7 +141,7 @@ task generateNativeInterface(type: Exec, dependsOn: [tasks.unpackJextract]) {
commandLine jextractBinary,
'--include-dir', includeDir,
'--output', generatedSrc,
'--target-package', 'org.itsallcode.jlua.ffi',
'--target-package', 'org.itsallcode.luava.ffi',
'--library', 'lua',
'--header-class-name', 'Lua',
"$includeDir/all_lua.h"
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -3,4 +3,4 @@ plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'
}

rootProject.name = 'jlua'
rootProject.name = 'luava'
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.itsallcode.jlua;
package org.itsallcode.luava;

public class FunctionCallException extends LuaException {
private static final long serialVersionUID = 1L;
11 changes: 6 additions & 5 deletions src/main/java/org/itsallcode/jlua/LowLevelLua.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package org.itsallcode.jlua;
package org.itsallcode.luava;

import java.lang.foreign.Arena;
import java.lang.foreign.MemorySegment;

import org.itsallcode.jlua.ffi.Lua;
import org.itsallcode.jlua.ffi.lua_KFunction;
import org.itsallcode.jlua.ffi.lua_KFunction.Function;
import org.itsallcode.luava.ffi.Lua;
import org.itsallcode.luava.ffi.lua_KFunction;
import org.itsallcode.luava.ffi.lua_KFunction.Function;

class LowLevelLua implements AutoCloseable {
private final Arena arena;
@@ -36,7 +36,8 @@ void pcall(final int nargs, final int nresults, final int errfunc, final long ct
pcall(nargs, nresults, errfunc, ctx, function);
}

void pcall(final int nargs, final int nresults, final int errfunc, final long ctx, final Function upcallFunction) {
void pcall(final int nargs, final int nresults, final int errfunc, final long ctx,
final lua_KFunction.Function upcallFunction) {
final MemorySegment k = lua_KFunction.allocate(upcallFunction, arena);
final int error = Lua.lua_pcallk(state, nargs, nresults, errfunc, ctx, k);
if (error != 0) {
2 changes: 1 addition & 1 deletion src/main/java/org/itsallcode/jlua/LuaException.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.itsallcode.jlua;
package org.itsallcode.luava;

public class LuaException extends RuntimeException {
private static final long serialVersionUID = 1L;
4 changes: 2 additions & 2 deletions src/main/java/org/itsallcode/jlua/LuaFunction.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.itsallcode.jlua;
package org.itsallcode.luava;

import java.lang.foreign.Arena;
import java.lang.foreign.MemorySegment;

import org.itsallcode.jlua.ffi.Lua;
import org.itsallcode.luava.ffi.Lua;

public class LuaFunction {

2 changes: 1 addition & 1 deletion src/main/java/org/itsallcode/jlua/LuaInterpreter.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.itsallcode.jlua;
package org.itsallcode.luava;

public class LuaInterpreter implements AutoCloseable {

4 changes: 2 additions & 2 deletions src/main/java/org/itsallcode/jlua/LuaStack.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.itsallcode.jlua;
package org.itsallcode.luava;

import java.lang.foreign.Arena;
import java.lang.foreign.MemorySegment;
import java.nio.charset.StandardCharsets;

import org.itsallcode.jlua.ffi.Lua;
import org.itsallcode.luava.ffi.Lua;

class LuaStack {
private final MemorySegment state;
4 changes: 2 additions & 2 deletions src/main/java/org/itsallcode/jlua/LuaTable.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.itsallcode.jlua;
package org.itsallcode.luava;

import java.lang.foreign.Arena;
import java.lang.foreign.MemorySegment;

import org.itsallcode.jlua.ffi.Lua;
import org.itsallcode.luava.ffi.Lua;

public class LuaTable {
private final LuaStack stack;
4 changes: 2 additions & 2 deletions src/main/java/org/itsallcode/jlua/LuaType.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.itsallcode.jlua;
package org.itsallcode.luava;

import java.util.Arrays;

import org.itsallcode.jlua.ffi.Lua;
import org.itsallcode.luava.ffi.Lua;

public enum LuaType {
NONE(Lua.LUA_TNONE()), NIL(Lua.LUA_TNIL()), BOOLEAN(Lua.LUA_TBOOLEAN()), LIGHT_USERDATA(Lua.LUA_TLIGHTUSERDATA()),
2 changes: 1 addition & 1 deletion src/test/java/org/itsallcode/jlua/LowLevelLuaTest.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.itsallcode.jlua;
package org.itsallcode.luava;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
6 changes: 2 additions & 4 deletions src/test/java/org/itsallcode/jlua/LuaInterpreterTest.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package org.itsallcode.jlua;
package org.itsallcode.luava;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertThrows;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.*;
import org.junit.jupiter.api.function.Executable;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
6 changes: 2 additions & 4 deletions src/test/java/org/itsallcode/jlua/LuaStackTest.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package org.itsallcode.jlua;
package org.itsallcode.luava;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.*;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;

0 comments on commit 9195064

Please sign in to comment.