Questions tagged [luaj]

Luaj is a pure Java implementation of a Lua interpreter (for versions 5.1 and now 5.2)

  • Java-centric implementation of lua vm built to leverage standard Java features.
  • Lightweight, high performance execution of lua.
  • Multi-platform to be able to run on JME, JSE, or JEE environments.
  • Complete set of libraries and tools for integration into real-world projects.
  • Dependable due to sufficient unit testing of vm and library features.

Luaj is written for JME and JSE, with string, table, package, math, io, os, debug, coroutine & luajava libraries, JSR-223 bindings, all metatags, weak tables and unique direct lua-to-java-bytecode compiling.

https://sourceforge.net/projects/luaj/

and

http://www.luaj.org/luaj/3.0/README.html#1

99 questions
0
votes
0 answers

How to import `.jar` file to lua code and create java instance?

Here is ex how to call new instance of java obj, but how to import mylib.jar is not explained For ex. I have mylib.jar and there is class com.example.MyClass. public class MyClass{ public String getHelloPersonName(String name){ …
NickUnuchek
  • 11,794
  • 12
  • 98
  • 138
0
votes
1 answer

LuaJ Vector Class

I am trying to create a Vector class for use with LuaJ. The end goal is to have the user not write much lua, and have most of the work done on my Java engine. As my understanding goes, I need to set the metatable for the lua representation of my…
orange451
  • 21
  • 4
0
votes
1 answer

How to expose java object to LuaJ

I've recently started learning Lua because I need to use it in a Java application I'm working on. For this I'm using LuaJ. I've searched around on the internet and found out how you can expose a Java method to LuaJ but I can't find out how to expose…
Charanor
  • 810
  • 8
  • 23
0
votes
1 answer

Should I have a single or multiple script files?

I'm creating a program in Java that uses scripting. I'm just wondering if I should split my scripts into one file for each script (more realistically every type of script like "math scripts" and "account scripts" etc.), or if I should use one…
Charanor
  • 810
  • 8
  • 23
0
votes
1 answer

Difference between bindClass and newInstance

What is the difference between these two functions in luajava: -- I know this creates a new instance of a class local instance = luajava.newInstance("path.to.class"); -- But it seems this does as well? local class =…
Charanor
  • 810
  • 8
  • 23
0
votes
1 answer

How to execute a linux terminal command from LUAJ?

I want to simply execute a linux terminal command like ls from LuaJ and the result that it will return or anything that returns i want to receive it and will show the names in the Java Gui. I searched but found this but not one with LuaJ. Is there…
Setu Kumar Basak
  • 11,460
  • 9
  • 53
  • 85
0
votes
1 answer

Require doesn't find shared libraries

I'm trying to run a neural network from torch inside Java. I'm using luaj as a wrapper. The problem is that when I require for example the torch module which depends on the libpaths module which is a shared library it throws the following…
erno.th
  • 11
  • 2
0
votes
1 answer

LuaJ How to create instance of Java object in Lua script?

I have Java class: class SomeClass{ private int i; public SomeClass(int i){ this.i = i; } } And I need to create instance of this class in Lua script and pass it to Java function, using LuaJ library. How I can do it?
V. Moroz
  • 171
  • 1
  • 9
0
votes
1 answer

LuaJ - Creating a Lua function in Java

Is there a way to create a Lua function in Java and pass it to Lua to assign it into a variable? For example: In my Java class: private class doSomething extends ZeroArgFunction { @Override public LuaValue call() { return "function…
diegocmaia
  • 79
  • 1
  • 10
0
votes
1 answer

LuaJ wrong return type conversion

I have the following code, which does not work as I expected, using LuaJ. /* imports ommited */ public class LuaTest { public static String name = "script"; public static String script = "function numbers()" + " return 200, 100" + " …
0
votes
2 answers

LuaJ does not supply command line arguments correctly

I tried the utility method provided by luaj to call a lua file with command line args (this one http://lua-users.org/wiki/SourceCodeFormatter) Globals globals = JsePlatform.standardGlobals(); String script ="src/codeformatter.lua"; File f =…
Steve
  • 738
  • 1
  • 9
  • 30
0
votes
1 answer

LUAJ Coerced Java object won't accept LuaValue argument

I've come across an issue with LuaJ not accepting an LuaValue as an argument when the Java code specifically asks for an LuaValue. public void registerEvent(LuaValue id, String event, String priority, LuaValue callback) { …
0
votes
1 answer

LuaJ hyperbolic library example using set() instead of require()

I'm using the example listed here: http://www.luaj.org/luaj/3.0/README.html#5 It works fine, but instead of using inside the Lua script: require 'hyperbolic' I would like to use this or something similar in the java code _G.set("hyperbolic", new…
Air In
  • 945
  • 1
  • 6
  • 11
0
votes
1 answer

LuaJ how to run the function on the calling object ( LuaJ is making new object How Can it be avoided.)

I have made a trival example from luaj website.. LuaJ I am trying to run a function on the current object which is currently being used. but luaJ is making a new object. How can I run the function on the current object, not making a new one.…
BravoAlphaRomeo
  • 25
  • 1
  • 1
  • 5
0
votes
1 answer

java - LuaJ: more than 3 arguments

Is there any possible to use more than three arguments in lua function? Here is my piece of code: LuaValue luaGlobals = JsePlatform.standardGlobals(); luaGlobals.get("dofile").call(LuaValue.valueOf("./data/Actions/" + a_itemScript)); …
Dragomirus
  • 439
  • 3
  • 14