Luaj Use java run the lua sprite, and Calling the Java object backwards is NULL #101

Closed
opened 2022-02-25 12:02:15 +00:00 by Yecgaa1 · 4 comments
Yecgaa1 commented 2022-02-25 12:02:15 +00:00 (Migrated from github.com)

1

I use debugging, and I'm pretty sure the code will execute to get there. but
Does it seem impossible to call Java backwards in a Lua script, but create a completely new JVM?
Otherwise why do I call all variables null, even if it's static.
Did I miss any important code? Or do I have a problem with my intentions?

![1](https://i.stack.imgur.com/HIMtp.jpg) I use debugging, and I'm pretty sure the code will execute to get there. but Does it seem impossible to call Java backwards in a Lua script, but create a completely new JVM? Otherwise why do I call all variables null, even if it's static. Did I miss any important code? Or do I have a problem with my intentions?
dianwangwin commented 2022-03-16 04:52:28 +00:00 (Migrated from github.com)

me too and i dont know what happened

me too and i dont know what happened
dianwangwin commented 2022-03-16 17:06:02 +00:00 (Migrated from github.com)

1

I use debugging, and I'm pretty sure the code will execute to get there. but Does it seem impossible to call Java backwards in a Lua script, but create a completely new JVM? Otherwise why do I call all variables null, even if it's static. Did I miss any important code? Or do I have a problem with my intentions?

可能是Class Loader的问题

> ![1](https://camo.githubusercontent.com/c228ccfa140931903d1690ab1bb53851e591d9dbe57d055dc189da9965275cd6/68747470733a2f2f692e737461636b2e696d6775722e636f6d2f48494d74702e6a7067) > > I use debugging, and I'm pretty sure the code will execute to get there. but Does it seem impossible to call Java backwards in a Lua script, but create a completely new JVM? Otherwise why do I call all variables null, even if it's static. Did I miss any important code? Or do I have a problem with my intentions? 可能是Class Loader的问题
orange451 commented 2022-05-20 20:13:22 +00:00 (Migrated from github.com)

I would suggest calling the load() method from Globals, instead of loadFile(). This means you have to write your own file-reading code. It will help in debugging why it cannot load your script.

Additionally, in my implementation, I use the invoke() method instead of call() method.

--
在Globals里面应该用的是Globals#load()。不要用Globals#loadFile()。
还有一个就是,在我的APP里面,我不用LuaFunction#call(), 我用的是LuaFunction#invoke()

I would suggest calling the load() method from Globals, instead of loadFile(). This means you have to write your own file-reading code. It will help in debugging why it cannot load your script. Additionally, in my implementation, I use the invoke() method instead of call() method. -- 在Globals里面应该用的是Globals#load()。不要用Globals#loadFile()。 还有一个就是,在我的APP里面,我不用LuaFunction#call(), 我用的是LuaFunction#invoke()
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: open-autonomous-connection/luaj#101