comparison core/src/luan/modules/PackageLuan.java @ 578:60c549d43988

remove LuanState.exception()
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 14 Jul 2015 17:40:48 -0600
parents 7c3ad6db8ac3
children 859c0dedc8b6
comparison
equal deleted inserted replaced
577:d7a85fbe15f1 578:60c549d43988
33 } 33 }
34 34
35 public static Object require(LuanState luan,String modName) throws LuanException { 35 public static Object require(LuanState luan,String modName) throws LuanException {
36 Object mod = load(luan,modName); 36 Object mod = load(luan,modName);
37 if( mod==null ) 37 if( mod==null )
38 throw luan.exception( "module '"+modName+"' not found" ); 38 throw new LuanException(luan, "module '"+modName+"' not found" );
39 return mod; 39 return mod;
40 } 40 }
41 41
42 public static Object load(LuanState luan,String modName) throws LuanException { 42 public static Object load(LuanState luan,String modName) throws LuanException {
43 LuanTable loaded = loaded(luan); 43 LuanTable loaded = loaded(luan);
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;
60 throw luan.exception( "module '"+modName+"' returned nil" ); 60 throw new LuanException(luan, "module '"+modName+"' returned nil" );
61 } 61 }
62 } 62 }
63 loaded.rawPut(modName,mod); 63 loaded.rawPut(modName,mod);
64 } 64 }
65 return mod; 65 return mod;