Mercurial Hosting > luan
diff src/luan/modules/BasicLuan.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 | c88b486a9511 |
line wrap: on
line diff
--- a/src/luan/modules/BasicLuan.java Tue Feb 12 21:50:26 2019 -0700 +++ b/src/luan/modules/BasicLuan.java Tue Feb 12 22:33:40 2019 -0700 @@ -9,7 +9,6 @@ import java.util.ArrayList; import java.util.Arrays; import luan.Luan; -import luan.LuanState; import luan.LuanTable; import luan.LuanFunction; import luan.LuanException; @@ -31,7 +30,7 @@ return Luan.load(text,sourceName,env); } - public static LuanFunction load_file(LuanState luan,String fileName) throws LuanException { + public static LuanFunction load_file(Luan luan,String fileName) throws LuanException { if( fileName == null ) { fileName = "stdin:"; } else if( fileName.indexOf(':') == -1 ) { @@ -55,7 +54,7 @@ int i = 0; final int size = list.size(); - @Override public Object[] call(LuanState luan,Object[] args) { + @Override public Object[] call(Luan luan,Object[] args) { if( i >= size ) return LuanFunction.NOTHING; Object val = list.get(i++); @@ -104,11 +103,11 @@ throw new LuanException( "bad argument #1 to 'raw_len' (table or string expected)" ); } - public static String to_string(LuanState luan,Object v) throws LuanException { + public static String to_string(Luan luan,Object v) throws LuanException { return luan.toString(v); } - public static LuanTable new_error(LuanState luan,Object msg) throws LuanException { + public static LuanTable new_error(Luan luan,Object msg) throws LuanException { String s = luan.toString(msg); LuanTable tbl = new LuanException(s).table(luan); tbl.rawPut( "message", msg ); @@ -138,7 +137,7 @@ return new LuanFunction() { double v = from; - @Override public Object call(LuanState luan,Object[] args) { + @Override public Object call(Luan luan,Object[] args) { if( step > 0.0 && v > to || step < 0.0 && v < to ) return LuanFunction.NOTHING; double rtn = v; @@ -152,7 +151,7 @@ return new LuanFunction() { int i = 0; - @Override public Object call(LuanState luan,Object[] unused) { + @Override public Object call(Luan luan,Object[] unused) { if( i >= args.length ) return LuanFunction.NOTHING; Object val = args[i++]; @@ -165,7 +164,7 @@ return obj instanceof LuanFunction ? (LuanFunction)obj : null; } - public static Object try_(LuanState luan,LuanTable blocks,Object... args) throws LuanException { + public static Object try_(Luan luan,LuanTable blocks,Object... args) throws LuanException { Utils.checkNotNull(blocks); Object obj = blocks.get(1); if( obj == null ) @@ -199,7 +198,7 @@ } } - @LuanMethod public static Object[] pcall(LuanState luan,LuanFunction f,Object... args) { + @LuanMethod public static Object[] pcall(Luan luan,LuanFunction f,Object... args) { try { Object[] r = Luan.array(f.call(luan,args)); Object[] rtn = new Object[r.length+1];