Mercurial Hosting > luan
diff src/luan/modules/PackageLuan.java @ 1333:25746915a241
merge Luan and LuanState
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 12 Feb 2019 22:33:40 -0700 |
parents | f41919741100 |
children | e0cf0d108a77 |
line wrap: on
line diff
--- a/src/luan/modules/PackageLuan.java Tue Feb 12 21:50:26 2019 -0700 +++ b/src/luan/modules/PackageLuan.java Tue Feb 12 22:33:40 2019 -0700 @@ -6,7 +6,6 @@ import java.util.Arrays; import java.util.Collections; import luan.Luan; -import luan.LuanState; import luan.LuanTable; import luan.LuanFunction; import luan.LuanJavaFunction; @@ -19,13 +18,13 @@ public static final LuanFunction requireFn; static { try { - requireFn = new LuanJavaFunction(PackageLuan.class.getMethod("require",LuanState.class,String.class),null); + requireFn = new LuanJavaFunction(PackageLuan.class.getMethod("require",Luan.class,String.class),null); } catch(NoSuchMethodException e) { throw new RuntimeException(e); } } - public static LuanTable loaded(LuanState luan) { + public static LuanTable loaded(Luan luan) { LuanTable tbl = (LuanTable)luan.registry().get("Package.loaded"); if( tbl == null ) { tbl = new LuanTable(luan); @@ -34,14 +33,14 @@ return tbl; } - public static Object require(LuanState luan,String modName) throws LuanException { + public static Object require(Luan luan,String modName) throws LuanException { Object mod = load(luan,modName); if( mod.equals(Boolean.FALSE) ) throw new LuanException( "module '"+modName+"' not found" ); return mod; } - public static Object load(LuanState luan,String modName) throws LuanException { + public static Object load(Luan luan,String modName) throws LuanException { LuanTable loaded = loaded(luan); Object mod = loaded.rawGet(modName); if( mod == null ) { @@ -86,7 +85,7 @@ return mod; } - static String read(LuanState luan,String uri) { + static String read(Luan luan,String uri) { LuanTable boot; try { boot = (LuanTable)luan.require("luan:Boot.luan"); @@ -104,7 +103,7 @@ } } - public static void enableLoad(LuanState luan,String... mods) throws LuanException { + public static void enableLoad(Luan luan,String... mods) throws LuanException { if( !luan.isLocked ) return; LuanTable loaded = loaded(luan);