Native modules support #77

Closed
opened 2020-09-15 16:21:37 +00:00 by ildar · 6 comments
ildar commented 2020-09-15 16:21:37 +00:00 (Migrated from github.com)

Lua is rich with its modules. But LuaJ seem to lack the part which is C-modules.

Anyone have an idea how C-modules can be used?

I'd ask in a community forum or chat but didn't find one.

Lua is rich with its modules. But LuaJ seem to lack the part which is C-modules. Anyone have an idea how C-modules can be used? I'd ask in a community forum or chat but didn't find one.
jplwill commented 2020-09-15 16:24:56 +00:00 (Migrated from github.com)

LuaJ's "userdata" types are Java objects. You'd have to use JNI to wrap the C modules as Java objects. Non-trivial.

LuaJ's "userdata" types are Java objects. You'd have to use JNI to wrap the C modules as Java objects. Non-trivial.
ildar commented 2020-09-22 05:25:20 +00:00 (Migrated from github.com)

I understand. That's why asking about "ideas".

I understand. That's why asking about "ideas".
jplwill commented 2020-09-22 13:48:11 +00:00 (Migrated from github.com)

Maybe there's a tool that will produce a JNI wrapping for a C API that you could use as a first step? It looks like SWIG has some kind of support for making JNI wrappers for C code.

Maybe there's a tool that will produce a JNI wrapping for a C API that you could use as a first step? It looks like SWIG has some kind of support for making JNI wrappers for C code.
ildar commented 2020-09-22 16:38:38 +00:00 (Migrated from github.com)

This whole situation with C modules makes LuaJ somewhat separated from Lua
existing ecosystem, right? Or i take it wrong?

This whole situation with C modules makes LuaJ somewhat separated from Lua existing ecosystem, right? Or i take it wrong?
jplwill commented 2020-09-22 16:42:22 +00:00 (Migrated from github.com)

Bearing in mind that I'm a newcomer to Lua: LuaJ strikes me as a way to embed Lua in Java apps and libraries, NOT as a platform for general Lua programming. I wouldn't expect everything in the normal Lua ecosystem to work with LuaJ. It's based on Lua 5.1 to begin with; any Lua library that requires 5.2+ is going to have trouble.

Bearing in mind that I'm a newcomer to Lua: LuaJ strikes me as a way to embed Lua in Java apps and libraries, NOT as a platform for general Lua programming. I wouldn't expect everything in the normal Lua ecosystem to work with LuaJ. It's based on Lua 5.1 to begin with; any Lua library that requires 5.2+ is going to have trouble.
Enyby commented 2020-09-22 18:28:33 +00:00 (Migrated from github.com)

LuaJ not support or implement Lua C layer. So you can not use Lua C libraries.
If you need run C code you can load and run libs via Java calls like System.loadLibrary().

Go to Readme and re-read LuaJ goals.

LuaJ not support or implement Lua C layer. So you can not use Lua C libraries. If you need run C code you can load and run libs via Java calls like System.loadLibrary(). Go to Readme and re-read LuaJ goals.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: open-autonomous-connection/luaj#77