Questions tagged [luajava]

A scripting tool for Java that allows easy interfacing of Lua and Java code by allowing Lua code to access and manipulate Java objects and allowing Java code to implement interfaces using Lua.

LuaJava is a scripting tool for Java that allows scripts written in Lua to manipulate components developed in Java and also access components from Lua using the same syntax that is used for accessing Lua`s native objects. It also allows Java to implement an interface using Lua.

The official website is http://www.keplerproject.org/luajava/.

55 questions
1
vote
1 answer

Lua Error Attempt to perform arithmetic on local variable

Here is the function calc.lua: function foo(n) return n*2 end Here is my LuaJavaCall L.getGlobal("foo"); L.pushJavaObject(8); int retCode=L.pcall(1,1,0); // nResults)//L.pcall(1, 1,-2); String errstr = L.toString(-1); // Attempt to perform…
Androider
  • 21,125
  • 36
  • 99
  • 158
1
vote
0 answers

LuaJava what is the definition of status code when calling LuaState.pcall(..)

I am trying to call a function in LuaJava. I am always getting back 5 as the status code. So int ok=LuaState.pcall(1,1,-1); always returns 5. calling the same function from the command line works fine. What is the meaning of 5 as a return code? …
Androider
  • 21,125
  • 36
  • 99
  • 158
1
vote
1 answer

Lua Getting Result Back in LuaJava from Lua function call

How does one get the value back from a Lua function call in LuaJava. Lets say I have calc.lua: function foo(n) return n*2 end I call the function in Java as follows: LuaState luaState; this.luaState =…
Androider
  • 21,125
  • 36
  • 99
  • 158
1
vote
1 answer

LuaJ (Java Lua Library): Calling Lua functions in other files from a Lua file

To begin, I'm aware of this question, but I don't think it quite fits what I'm doing. Either way, the answer is a bit confusing my opinion. I'd like to find an answer for my problem that's more specific to what I'm doing. The goal here is for the…
Anonymous
  • 696
  • 8
  • 21
1
vote
0 answers

Returning and Getting values in LuaJava

I'm new to using LuaJava in Java, and currently I only know how to call functions and push objects to Lua using Java. luaState.getGlobal(function); luaState.pushJavaObject(obj); luaState.call(1, 1); Now I was wondering how I can return a Lua…
RayShawnOfNapalm
  • 210
  • 6
  • 20
1
vote
1 answer

AndroLua on Lollipop: JNI DETECTED ERROR IN APPLICATION: can't call static int org.keplerproject.luajava.LuaJavaAPI.javaNew(int, java.lang.Class)

I want to use AndroLua as library in my Android application. Everything goes well on Android version except Android 5.x (Lollipop) But my app crashed under Lollipop if I call juajava.new lua function. The logcat shows JNI DETECTED ERROR IN…
WeiHung
  • 109
  • 2
  • 10
1
vote
1 answer

How to load Lua-Filesystem and Lua-Penlight in Luaj

I have a program using the Luaj 3.0 libraries and I found some lua scripts I want to include, but they all require lua file system and penlight and whenever I try to use those libraries, it gives an error. Does anyone know how I am supposed to make…
Thomas
  • 871
  • 2
  • 8
  • 21
1
vote
0 answers

Foreach loop through Java Hashmap in Lua

So I'm new to Lua and I've got LuaJava running with my Java code, but I'm stuck trying to figure out how to run a foreach loop on a hashmap in Lua. In my java code I have this: Java public class EntityManager { public static EntityManager…
1
vote
1 answer

LuaJava: Call methods on Lua object from Java?

I have Java/Scala code that is calling out to Lua via LuaJava. I would like to mimic some of the object hierarchy from the J/S pipeline to the Lua pipeline; basically to have companion objects in the languages. In other words, if I create a…
1
vote
1 answer

How to pass class via reflection luaj - java

I use LuaJ, it contains a library: luajava which allows to pass a class via Reflection to lua enviroment. Do you know how to do this?? I noticed that there is a way to pass compiled class: _G.get("load").call(LuaValue.valueOf( "sys =…
user1685503
  • 173
  • 1
  • 10
1
vote
1 answer

LNK2019 unresolved symbol compiling LuaJava with Visual Studio 2012

I am working with visual studio 2012 to compile LuaJava. The problem I am having is when I call the linker. The line that calls the linker in the makefile is: link /dll /LIBPATH:"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\x64" …
dbarton91
  • 91
  • 2
  • 8
1
vote
0 answers

Luajava HeapWorker is wedged while executing big script

In my Android application I'm getting E/dalvikvm: HeapWorker is wedged: 10629ms (generally more than 10 sec) spent inside Lorg/keplerproject/luajava/LuaObject;.finalize()V Searched for the answer and found information about garbage collector…
netfox
  • 11
  • 2
1
vote
1 answer

Passing java object Reference to Lua

I want to know how to pass Java Object reference to Lua Is there lua_newuserdata equivalent in Lua Java Binding ? I am using jnlua library. After creating newuserdata how do i pass it to lua using openlib in java ?
1
vote
1 answer

Transfering data between Lua scripts and Java application with LuaJava

I've read many great things about LuaJava (library). However, I still can't find any good documentation on how to transfer data between the Lua scripts and Java application. How is this done? I apologize if I missed a tutorial somewhere...
TheNickmaster21
  • 275
  • 3
  • 13
1
vote
1 answer

Alternative way to connect Lua and Java

I've been searching for this for hours now: I have a lua script with variables I'd like to add to a java program. Is there an other way than using luajava (which I tried to set up with no luck), or something like write to a text file than read from…
Ferenc Dajka
  • 1,052
  • 3
  • 17
  • 45