-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add LuaJ bindings #164
Merged
Merged
Add LuaJ bindings #164
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #164 +/- ##
============================================
- Coverage 94.43% 94.36% -0.07%
Complexity 610 610
============================================
Files 31 31
Lines 1455 1456 +1
Branches 184 184
============================================
Hits 1374 1374
Misses 64 64
- Partials 17 18 +1 ☔ View full report in Codecov by Sentry. |
gudzpoz
force-pushed
the
luaj-backend
branch
3 times, most recently
from
March 29, 2024 10:47
8c0fb97
to
f7dcfae
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds LuaJ bindings to LuaJava, hopefully serving as a placeholder for platforms without binaries (or not yet supported by
jnigen
). For example, iOS users may use LuaJ bindings since they are pure Java.There are several caveats though:
A fork of LuaJ is used since the original one is unmaintained. However, the fork has yet to publish a Maven artifact, and before that, we need to use JitPack.
LuaJ uses Java threads (heavyweight before Loom) for Lua coroutines (generally lightweight). It can become a problem if the user uses coroutines heavily.
LuaJ does not provide Lua C API, upon which this library builds. A compatible layer is added, but there are several hidden behavioral changes in stack operations:
When a LuaJ function is called, the library does not supply a
lua_State
-like pointer, which means we cannot possibly manipulate the stack from within the function. This is handled by tracking the thread that created the function / any value, while standard Lua operates on the current thread.Thanks JNI, we were able to call the default function defined by interfaces. However, in LuaJ, this is not possible any more: all we have access to is Java reflection API.
LuaJ uses some classes that are introduced in Java 8 API but not available in lower Android API levels. We just don't test on those Android versions. (Having trouble setting up Android desugaring.)
These should have been documented in
docs/
?