Lua Error Attempt to perform arithmetic on local variable
问题 Here is the function calc.lua: function foo(n) return n*2 end Here is my LuaJavaCall L.getGlobal("foo"); L.pushJavaObject(8); int retCode=L.pcall(1,1,0); // nResults)//L.pcall(1, 1,-2); String errstr = L.toString(-1); // Attempt to perform arithmetic on local variable 'n' Update: as indicated below I needed to use L.pushNumber(8.0) instead of L.pushJavaObject() 回答1: Try using L.pushNumber instead of L.pushJavaObject like this: L.getGlobal("foo"); L.pushNumber(8.0); int retCode = L.pcall(1,1,0