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?
I’m using LuaJ, and I have a .lua file filled with a bunch of
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.