try to load lua before Java classes for -l argument.

This commit is contained in:
James Roseborough
2009-04-09 17:31:06 +00:00
parent 1d40b52348
commit 99d5baeeab

View File

@@ -148,6 +148,14 @@ public class lua {
private static void loadLibrary( LuaState vm, String libname ) throws IOException { private static void loadLibrary( LuaState vm, String libname ) throws IOException {
try { 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 ); Class c = Class.forName( libname );
Object i = c.newInstance(); Object i = c.newInstance();
LFunction f = (LFunction) i; LFunction f = (LFunction) i;