Mercurial Hosting > luan
diff core/src/luan/modules/IoLuan.java @ 426:23a93c118042
fix LuanTable.get() to use metatables
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 01 May 2015 18:44:20 -0600 |
parents | b31d614343e8 |
children | dae264ad6a7b |
line wrap: on
line diff
--- a/core/src/luan/modules/IoLuan.java Fri May 01 17:18:23 2015 -0600 +++ b/core/src/luan/modules/IoLuan.java Fri May 01 18:44:20 2015 -0600 @@ -545,8 +545,8 @@ } public static LuanTable stdin(LuanState luan) throws LuanException { - LuanTable io = (LuanTable)PackageLuan.loaded(luan).get("luan:Io"); - return (LuanTable)io.get("stdin"); + LuanTable io = (LuanTable)PackageLuan.require(luan,"luan:Io"); + return (LuanTable)io.get(luan,"stdin"); } public static LuanTable newSchemes() { @@ -566,11 +566,11 @@ return schemes; } - private static LuanTable schemes(LuanState luan) { - LuanTable t = (LuanTable)PackageLuan.loaded(luan).get("luan:Io"); + private static LuanTable schemes(LuanState luan) throws LuanException { + LuanTable t = (LuanTable)PackageLuan.loaded(luan).rawGet("luan:Io"); if( t == null ) return newSchemes(); - t = (LuanTable)t.get("schemes"); + t = (LuanTable)t.get(luan,"schemes"); if( t == null ) return newSchemes(); return t; @@ -583,7 +583,7 @@ String scheme = name.substring(0,i); String location = name.substring(i+1); LuanTable schemes = schemes(luan); - LuanFunction opener = (LuanFunction)schemes.get(scheme); + LuanFunction opener = (LuanFunction)schemes.get(luan,scheme); if( opener == null ) throw luan.exception( "invalid scheme '"+scheme+"' in '"+name+"'" ); return (LuanTable)Luan.first(luan.call(opener,"<open \""+name+"\">",new Object[]{location})); @@ -618,7 +618,7 @@ return new PickleClient(luan,in,out).table(); } - public void run_pickle_server(LuanState luan) throws IOException { + public void run_pickle_server(LuanState luan) throws IOException, LuanException { InputStream in = new BufferedInputStream(inputStream()); OutputStream out = new BufferedOutputStream(outputStream()); new PickleServer(luan,in,out).run(); @@ -679,7 +679,7 @@ private static String SECURITY_KEY = "Io.Security"; private static void check(LuanState luan,String name) throws LuanException { - Security s = (Security)luan.registry().get(SECURITY_KEY); + Security s = (Security)luan.registry().rawGet(SECURITY_KEY); if( s!=null ) s.check(luan,name); }