Mercurial Hosting > luan
comparison core/src/luan/modules/PackageLuan.java @ 265:454a486d9c19
allow IO on files that don't exist
git-svn-id: https://luan-java.googlecode.com/svn/trunk@266 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Wed, 29 Oct 2014 16:26:42 +0000 |
parents | 9e0d4452e649 |
children | 1507149fc447 |
comparison
equal
deleted
inserted
replaced
264:9e0d4452e649 | 265:454a486d9c19 |
---|---|
85 } | 85 } |
86 } | 86 } |
87 return mod; | 87 return mod; |
88 } | 88 } |
89 | 89 |
90 public static Object[] search(LuanState luan,String modName) throws LuanException { | 90 static LuanFunction loader(LuanState luan,String name,boolean loading) throws LuanException { |
91 LuanTable t = IoLuan.get(luan,modName,true); | 91 LuanTable t = IoLuan.get(luan,name,loading); |
92 if( t == null ) | 92 if( t == null ) |
93 return null; | 93 return null; |
94 LuanFunction loader = (LuanFunction)t.get("loader"); | 94 LuanFunction loader = (LuanFunction)t.get("loader"); |
95 LuanFunction fn = (LuanFunction)Luan.first(luan.call(loader,new Object[]{modName})); | 95 if( loader == null ) |
96 return new Object[]{fn,modName}; | 96 return null; |
97 return (LuanFunction)Luan.first(luan.call(loader,new Object[]{name})); | |
98 } | |
99 | |
100 public static Object[] search(LuanState luan,String modName) throws LuanException { | |
101 LuanFunction fn = loader(luan,modName,true); | |
102 return fn==null ? null : new Object[]{fn,modName}; | |
97 } | 103 } |
98 | 104 |
99 | 105 |
100 public static void block(LuanState luan,String key) { | 106 public static void block(LuanState luan,String key) { |
101 blocked(luan).put(key,true); | 107 blocked(luan).put(key,true); |