Try using L.pushNumber instead of L.pushJavaObject as follows:
L.getGlobal("foo"); L.pushNumber(8.0); int retCode = L.pcall(1,1,0); String errstr = L.toString(-1);
Lua probably sees JavaObject as a type of 'userdata', in which case there are no predefined operations for it; Lua does not know what to do with JavaObject * 2 , since you have not decided how to handle it.
OTOH, Lua knows how to handle a number, since it is a built-in primitive type. For the code snippet you presented, tapping a number would be the least painful way to get it working instead of writing extra code that tells Lua how to work with numbers wrapped inside JavaObject.
source share