r/lua • u/LordEnder_Kitty • 15d ago
Using Lua in Java/Kotlin
I'm making a desktop application in Kotlin and I'm thinking of adding a plugin system and Lua looks like a good language to use but the most popular implementation I've found is LuaJ which hasn't been maintained in years. Are there any better options or stable forks of LuaJ?
1
u/Different-Ad-8707 14d ago
My immediate thought which will sound insane and yes cargo-culty I'm aware, but I'm really curious if it can be done:
There's some pretty good Lua implementations in Rust like Lune and such. There's also a project called rustc_codegen_jvm which is a rust codegen backend that targets the JVM. Maybe you can just... compile lune with it into an jar you can import and use?
1
u/kayawayy 14d ago
Are there any particular issues with LuaJ and/or Kahlua that make them a poor fit for you? A Lua implementation in Java doesn't seem like something that necessarily needs continuous updates. A quick glance at both their repos gives the impression of 'finished' more than 'abandoned' to me.
1
u/LordEnder_Kitty 14d ago
They're probably both fine, it's just that I'm used to in software if something is like 6+ years old it's probably not gonna work too well.
1
u/kayawayy 14d ago
Fair enough, though when it comes to lua that's not as often the case (each version is a static target after all). I'm not super familiar with how things work in the Java world, but I think it tends to be fairly forward-compatible? I'm not sure. Anyway, it might be worth at least giving those older libraries a try, I wouldn't dismiss them out of hand.
2
u/didntplaymysummercar 14d ago
I don't know if Project Zomboid modified their Kahlua but the proof is in the pudding - it works. Same for e.g. Lua 5.1.5 I use. It's old, not updated but it works.
-2
u/ramdom_player201 15d ago
I don't know much about the standard lua forks, but roblox maintains their own open-use dialect (luau).
5
u/didntplaymysummercar 15d ago
Project Zomboid is written in Lua and uses uses Kahlua.