Hello,

I finally figured out some workaround to make the "hyperbolic" sample work. But it's pretty ugly.

Maybe I'm just stupid, or maybe the Javadoc is outdated ?

First issue :

Here is the Javadoc lua code

local t = require('hyperbolic')

I had to figure out that the real code was something like

local t = require('com.feriaman.myluajtestproject.hyperbolic')

Second issue :

Here is the Javadoc Java code

public class hyperbolic extends org.luaj.vm2.lib.OneArgFunction { public hyperbolic() {} public LuaValue call(LuaValue arg) { switch ( opcode ) { case 0: { LuaValue t = tableOf(); this.bind(t, hyperbolic.class, new String[] { "sinh", "cosh" }, 1 ); env.set("hyperbolic", t); return t; } case 1: return valueOf(Math.sinh(arg.todouble())); case 2: return valueOf(Math.cosh(arg.todouble())); default: return error("bad opcode: "+opcode); } } }

But the "env" field doesn't exists, maybe it was replaced by something, but i didn't figured out what. So I Had to add my own static field named "env" and initialised it manually.

It is static because, as it is not automatically initialized, it would be null most of the times.

Here is the HUGLY code:

public class hyperbolic extends org.luaj.vm2.lib.OneArgFunction { public static LuaValue env; public hyperbolic() {} public LuaValue call(LuaValue arg) { switch ( opcode ) { case 0: { LuaValue t = tableOf(); this.bind(t, hyperbolic.class, new String[] { "sinh", "cosh" }, 1 ); env.set("hyperbolic", t); return t; } case 1: return valueOf(Math.sinh(arg.todouble())); case 2: return valueOf(Math.cosh(arg.todouble())); default: return error("bad opcode: "+opcode); } } } Globals globals = JsePlatform.debugGlobals(); hyperbolic toto = new hyperbolic(); toto.env = globals; globals.load(toto);