I'm using LuaJ, and I have a .lua
file filled with a bunch of functions. How do I import these functions to use in Java with LuaJ?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- How to get the return code of a shell script in lu
One option would be to compile the file into Java code and import that. Another would be to simply invoke the Lua file directly from your Java code using the embeddable interpreter.
* EDIT *
There are good examples in the downloaded documentation. To run a script from within Java you would do something like this:
To compile a Lua script into Java source code, you would do something like this:
These examples are pretty much taken from the README.html which you get when you download Luaj. I would highly recommend reading it end to end to get a good grasp of the available functionality.
I was looking around to solve this same problem myself and although this question was from January hopefully this post will help others looking for help.
test.java:
test.lua: