Coder Social home page Coder Social logo

jasonsantos / luajava Goto Github PK

View Code? Open in Web Editor NEW
377.0 377.0 127.0 557 KB

LuaJava is a scripting tool for Java. The goal of this tool is to allow scripts written in Lua to manipulate components developed in Java. LuaJava allows Java components to be accessed from Lua using the same syntax that is used for accessing Lua`s native objects, without any need for declarations or any kind of preprocessing. LuaJava also allows Java to implement an interface using Lua. This way any interface can be implemented in Lua and passed as parameter to any method, and when called, the equivalent function will be called in Lua, and it's result passed back to Java.

Home Page: http://www.keplerproject.org/luajava/

License: MIT License

Shell 0.09% Java 47.40% C 44.76% Lua 4.04% Makefile 1.10% HTML 2.52% Batchfile 0.08%

luajava's People

Contributors

hishamhm avatar jasonsantos avatar talklittle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

luajava's Issues

is it a bug with method invoke?

LuaJavaAPI:131

    if(Modifier.isPublic(method.getModifiers()))
    {
      method.setAccessible(true);
    }

isn't it should be if(!Modifier.isPublic(method.getModifiers())) ??

Update for lua 5.3.4 and future releases

How can I update LuaJava for Lua 5.3.4 and any other future releases? I found this repository with 5.3.1, however I would like to know if there is a simple way to update to new versions. There aren't much differences between 5.3.1-5.3.4 but that could still be useful, when they release 5.4 for example.

LuaObject finalize timeout

There is a synchronized block in LuaObject.finalize() which will leads to a dead lock when gc thread wants to finalize this luaObject and other paused thread is in another synchronized block with this luaObject.

luajava.new(...) produce error on Android ART

Calling luajava.new(...) produce the following error on Android ART:
A/art: art/runtime/java_vm_ext.cc:410] JNI DETECTED ERROR IN APPLICATION: can't call static int org.keplerproject.luajava.LuaJavaAPI.javaNew(int, java.lang.Class) with class java.lang.Class<java.lang.Class> A/art: art/runtime/java_vm_ext.cc:410] in call to CallStaticIntMethod

After some code review, I figured out the problem.
In luajava.c, line 1377:
ret = ( *javaEnv )->CallStaticIntMethod( javaEnv , clazz , method , (jint)stateIndex , classInstance );
"clazz" is not the object we want here. It should be:
ret = ( *javaEnv )->CallStaticIntMethod( javaEnv , luajava_api_class , method , (jint)stateIndex , classInstance );

Moreover, I think, line 1371:
if ( clazz == NULL || method == NULL )
should be:
if ( luajava_api_class == NULL || method == NULL )

Nir.

doesn't work with coroutines

Simple test:

local System = luajava.bindClass 'java.lang.System'
print(System:currentTimeMillis());
print("starting coroutine");

local status, info
local printer = coroutine.create(function()
    coroutine.yield(tostring(System))
    local f = System.currentTimeMillis
    coroutine.yield(tostring(f))
    coroutine.yield( f(System) )
  end)
repeat
  status, info = coroutine.resume(printer)
  print("co:", status, info)
until not status
print("co: done")

results in:

execute
1592982670150
starting coroutine
co:	true	userdata: 0x7f85e802d998
co:	true	function: 0x7f85e802e890
co:	true	userdata: 0x7f85e802d998
co:	true	nil
co:	false	cannot resume dead coroutine
co: done

Any explanation?

luajava.createProxy() does not create Object.hashCode/equals()

It seems that luajava.createProxy() does not create the appropriate object.hashCode() method - or it is wrong. Either way, calling hashCode() in a Dalvik VM was resulting in an NPE:

java.lang.NullPointerException: null result when primitive expected at $Proxy2.hashCode(Native Method)

This can be worked around by implementing hashCode() function in the table that you pass to createProxy.

edti: same is with the case of equals()

Is this by design?

Build on OSX

It seems like the Makefile is not longer able to work on OSX 10.7.5.

I keep getting issues along the lines of :

In file included from src/c/luajava.c:39:
src/c/luajava.h:2:17: error: jni.h: No such file or directory

It seems that in the switch from Apple to Oracle, things have been moved.

The Website is down!

The keplerprojects website is down and an updated documentation for Luajava would be very useful.

Thank you in advance!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.