Mercurial Hosting > luan
comparison src/luan/lib/JavaLib.java @ 51:28dfd91a816c
various small issues
git-svn-id: https://luan-java.googlecode.com/svn/trunk@52 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Fri, 28 Dec 2012 20:43:06 +0000 |
parents | 272b6f1d7dac |
children | 9381b23ea9e1 |
comparison
equal
deleted
inserted
replaced
50:272b6f1d7dac | 51:28dfd91a816c |
---|---|
185 this.cls = cls; | 185 this.cls = cls; |
186 } | 186 } |
187 } | 187 } |
188 | 188 |
189 public static Static getClass(LuanState luan,String name) throws LuanException { | 189 public static Static getClass(LuanState luan,String name) throws LuanException { |
190 try { | 190 Class cls; |
191 return new Static( Class.forName(name) ); | 191 try { |
192 cls = Class.forName(name); | |
192 } catch(ClassNotFoundException e) { | 193 } catch(ClassNotFoundException e) { |
193 throw new LuanException(luan,LuanElement.JAVA,e); | 194 try { |
194 } | 195 cls = Thread.currentThread().getContextClassLoader().loadClass(name); |
196 } catch(ClassNotFoundException e2) { | |
197 throw new LuanException(luan,LuanElement.JAVA,e); | |
198 } | |
199 } | |
200 return new Static(cls); | |
195 } | 201 } |
196 | 202 |
197 public static void importClass(LuanState luan,String name) throws LuanException { | 203 public static void importClass(LuanState luan,String name) throws LuanException { |
198 luan.global().put( name.substring(name.lastIndexOf('.')+1), getClass(luan,name) ); | 204 luan.global().put( name.substring(name.lastIndexOf('.')+1), getClass(luan,name) ); |
199 } | 205 } |