Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Duck {
- public void talk() { System.out.println("Duck quacks!"); }
- public void walk() { System.out.println("Duck walks!"); }
- }
- public class Person {
- public void talk() { System.out.println("Person talks!"); }
- public void walk() { System.out.println("Person walks!"); }
- }
- onTalk(obj)
- obj:talk();
- end
- onWalk(obj)
- obj:walk();
- end
- ScriptEngineManager sem = new ScriptEngineManager();
- ScriptEngine engine = sem.getEngineByExtension(".lua");
- ScriptEngineFactory factory = engine.getFactory();
- // Script defined above
- CompiledScript cs = ((Compilable)engine).compile(MY_LUA_SCRIPT);
- SimpleBindings b = new SimpleBindings();
- b = newSimpletBindings();
- LuaValue onWalkHandler = (LuaValue)b.get("onWalk");
- //func.call(LuaValue.valueOf(duck)); // Passing duck object does not work ???
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement