Hi I am using lua for my project but i have a bug when i want to call in
java side a lua function in a table. As example i wan't to call
t:show('hello'), it doesn't work it prints nil instead of hello. It makes
one week i try to search an answer in the net but i found nothing. So I ask
you if you kown why the code below does'nt work (I use luajava1-1 for win32
).
Test.java
final LuaState L = LuaStateFactory.newLuaState();
L.openLibs();
L.LdoFile("src/script/test.lua");
L.getGlobal("t");
L.getField(-1, "show");
L.pushString("hello");
L.call(1, 0);
test.lua
Test = {}
Test.__index = Test
function Test:create()
local obj = {} -- our new object
setmetatable(obj,Test) -- make Test handle lookup
return obj
end
function Test:show(message)
print(message);
end
-- create a Test object
t = Test.create()
_______________________________________________
Kepler-Project mailing list
[email protected]
http://lists.luaforge.net/cgi-bin/mailman/listinfo/kepler-project
http://www.keplerproject.org/