From 99d5baeeab313e50908102e0440912b8ae39b201 Mon Sep 17 00:00:00 2001 From: James Roseborough Date: Thu, 9 Apr 2009 17:31:06 +0000 Subject: [PATCH] try to load lua before Java classes for -l argument. --- src/j2se/lua.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/j2se/lua.java b/src/j2se/lua.java index 77eac4ed..7175cac2 100644 --- a/src/j2se/lua.java +++ b/src/j2se/lua.java @@ -148,6 +148,14 @@ public class lua { private static void loadLibrary( LuaState vm, String libname ) throws IOException { try { + // load via "require" + vm.getglobal("require"); + vm.pushstring(libname); + int status = vm.pcall(1, 0, 0); + if ( status == 0 ) + return; + + // load as java class Class c = Class.forName( libname ); Object i = c.newInstance(); LFunction f = (LFunction) i;