comparison core/src/luan/modules/PackageLuan.java @ 574:6cc2f047019b

remove LuanState.call()
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 13 Jul 2015 12:31:53 -0600
parents f1601a4ce1aa
children 7c3ad6db8ac3
comparison
equal deleted inserted replaced
573:894f991baac5 574:6cc2f047019b
49 String src = read(luan,modName,true); 49 String src = read(luan,modName,true);
50 if( src == null ) 50 if( src == null )
51 return null; 51 return null;
52 LuanFunction loader = BasicLuan.load(luan,src,modName,null,false); 52 LuanFunction loader = BasicLuan.load(luan,src,modName,null,false);
53 mod = Luan.first( 53 mod = Luan.first(
54 luan.call(loader,"<require \""+modName+"\">",new Object[]{modName}) 54 loader.call(luan,new Object[]{modName})
55 ); 55 );
56 if( mod == null ) { 56 if( mod == null ) {
57 mod = loaded.rawGet(modName); 57 mod = loaded.rawGet(modName);
58 if( mod != null ) 58 if( mod != null )
59 return mod; 59 return mod;
68 static String read(LuanState luan,String uri,Boolean addExtension) throws LuanException { 68 static String read(LuanState luan,String uri,Boolean addExtension) throws LuanException {
69 LuanTable t = IoLuan.uri(luan,uri,addExtension); 69 LuanTable t = IoLuan.uri(luan,uri,addExtension);
70 if( t == null ) 70 if( t == null )
71 return null; 71 return null;
72 LuanFunction existsFn = (LuanFunction)t.get(luan.JAVA,"exists"); 72 LuanFunction existsFn = (LuanFunction)t.get(luan.JAVA,"exists");
73 boolean exists = (Boolean)Luan.first(luan.call(existsFn)); 73 boolean exists = (Boolean)Luan.first(existsFn.call(luan));
74 if( !exists ) 74 if( !exists )
75 return null; 75 return null;
76 LuanFunction reader = (LuanFunction)t.get(luan.JAVA,"read_text"); 76 LuanFunction reader = (LuanFunction)t.get(luan.JAVA,"read_text");
77 return (String)Luan.first(luan.call(reader)); 77 return (String)Luan.first(reader.call(luan));
78 } 78 }
79 79
80 } 80 }