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
1
vote
1 answer

How can I use a list as a function parameter with LuaJ?

So, I have a function in a Lua script that takes an parameter. testFunction = function(listIn) for i, obj in ipairs(listIn) do print(i) end end This parameter is obviously meant to be a list of objects, but I simply cannot figure…
Wolfsurge
  • 27
  • 4
1
vote
2 answers

Making global environment access-only (Lua)

I embedded Lua and want scripts to be able to read the global table but not automatically write to it so two scripts can write variables with the same name without overwriting eachother but still being able to add stuff to the global table. I can't…
Timotheus
  • 2,250
  • 5
  • 29
  • 39
1
vote
0 answers

Luaj newInstance("java.lang.Byte") returns java.lang.Integer

When using LuaJ, I was tring to call a java method that needs a Byte argument. But when I use luajava.newInstance("java.lang.Byte","2") It turned out to be a java.lang.Integer and caused an error. java.lang.ClassCastException: class…
etwxr9
  • 11
  • 2
1
vote
1 answer

How to make global variables "immutable" in Lua/LuaJ?

Description I'm doing a LuaJ program, and here's a lib script like this: function foo() print("foo"); end I want the foo function can be invoked in other scripts directly (no require), but performs immutable in different scripts. ( Even a…
1
vote
0 answers

Write LuaTable to file

I'm trying to write a table with LUAJ and I want to export it to a file. Is it possible? final LuaTable innerTable = new LuaTable(); innerTable.set("key", "value"); final LuaTable parentTable = new LuaTable(); parentTable.set("parentKey",…
maqjav
  • 2,310
  • 3
  • 23
  • 35
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
1 answer

Combination of lua module and metatable-based class in LuaJ

I am following the example of simple lua class from this tutorial but try to store the class definition in a separate file and load as a module I created a simple class called List and I can create a list, and fill with following code…
Hai Bi
  • 1,173
  • 1
  • 11
  • 21
1
vote
0 answers

LuaJ: Pass object references to lua code

I'm currently working on a project with LuaJ, a library which allows for Java to interpret Lua code and execute it. From what I have gathered thus far, I can only pass in values which Lua itself can understand, such as primitives, tables, userdata…
HaedHutner
  • 79
  • 1
  • 4
1
vote
0 answers

LuaJ overwrite .new()

I am trying to overwrite the .new() lua function(method?) with LuaJ. I tried to set a "new" key in the metatable for my table, but when calling .new() in lua it is ignored and runs the default java-backed function of creating the table as a java…
orange451
  • 21
  • 4
1
vote
1 answer

How can I implement LuaJ pause?

I developing a game engine, and want the game to process a lua file. Currently I'm using a custom scripting language I wrote to store each command in a list the game can can execute. My scripting language is very primitive at this point, which is…
1
vote
1 answer

How to get Luaj function parameter names inside java class?

Is there any way to get the count and names of all the function parameters defined in .lua file? For eg my test1.lua is function MyAdd( num1, num2, num3) local x = 0 if(num1 <= num2) then x = num1 + num2 + num3 else x =…
codeboyz
  • 43
  • 1
  • 6
1
vote
1 answer

luaj doesn't find .so modules

I've written a GUI in Java and use a lua-script to calculate some values for images with a neural network. Therefore the lua-script requires some modules from torch7. I got so far that it finds the modules which have a init.lua file. However, it…
erno.th
  • 11
  • 2
1
vote
1 answer

LuaJ - What does CoerceJavaToLua do with a Java Object

If I were to do CoerceJavaToLua (new Vector2(3, 5)); What would it return, and how do I access the values in lua? Do I pass the returned value as such: globals.load(CoerceJavaToLua(new Vector2(3, 5)));
euwbah
  • 363
  • 1
  • 13
1
vote
3 answers

Luaj parse table content

I just started using luaj in my project and I want to get the string content inside my lua table. For example: t = { subTitle = "Haircut", } return t; I want get the content of subtitle which should be very simple but I have no idea how to do…
Zelin Zhu
  • 11
  • 3
1
vote
1 answer

Trying to use LUAJ in android app, can't find class Lua

I suspect my ignorance is more profound than just LUAJ, so please be gentle. GOAL: to run lua scripts periodically from within my app, passing data back and forth between Lua and Java, with a certain amount of security (don't let lua delete files,…
user1005997
  • 41
  • 1
  • 6