Open gudzpoz opened 1 month ago
LuaU is not fully compatible with Lua 5.1 C API. And to add to it, the incompatibilities are not well documented yet, making it extra hard to support or to catch up with any breaking changes that might follow.
Currently I don't think I have enough motivation (or energy) to support it (since it can potentially break too many things), but I will happily review any PR that aim to bring such support.
I will summarize the challenges here for anybody that is willing to work on this:
__gc
is not supported in LuaU, while LuaJava uses it to cooperate with Java GC. The code using __gc
is under jni/luajava/jua.cpp and you will need to rewrite it for LuaU by presumably using lua_newuserdatadtor
along with a bunch of #if
macros.LuaNatives
are generated with scripts under scripts/ that scrape lua.org manuals. Since LuaU does not offer a manual page, you will probably need to write a script to parse the C header files instead.LuaNatives
interface. If not, you will need to implement those functions yourself, similar to https://github.com/gudzpoz/luajava/blob/e0c39fd5b7c5a5b5425dcb2ef51bfd7910fe438a/lua51/jni/mod/luacomp.h#L17-L20libluau.a
library and then link jnigen code against it. I consider this step most challenging (and a bit tiresome) as we need to support all those platforms...
Discussed in https://github.com/gudzpoz/luajava/discussions/178