lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

No one cares about luajava?  : )


On Sun, Dec 1, 2013 at 1:24 AM, Bo HOU <enstb.bhou@gmail.com> wrote:
Hi All,


I am using luajava in my project,  but I met a problem when calling a javafunction from a coroutine. The parameter passed to that function in lua could not be found in the stack.

It seems that it is a known issue. I actually find an old post in the mail-list: http://lists.luaforge.net/pipermail/kepler-project/2006-June/000144.html
My question is: Is there any fix for this issue? I checked the luajava release history, no version mentions the related fix.

Thanks


In case you don't want to click the link above, here is a small test code:

In Java:

JavaFunction test = new JavaFunction(L) {

        @Override
        public int execute() throws LuaException {
          System.out.println("Size: " + L.getTop());
          return 0;
        }

      };

test.register("testJavaFunction");

In Lua:

testJavaFunction('param1', 'param2')

output: Size: 3

-- with coroutine
local co = coroutine.create(function()
  testJavaFunction('param1', 'param2')
end)
coroutine.resume(co)


output: Size: 1


Best regards,

Bo