Mercurial Hosting > luan
diff core/src/luan/modules/Utils.java @ 637:6ea90dc10375
bbcode parser now takes a quoter function
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 03 Mar 2016 12:38:24 -0700 |
parents | 31926755689e |
children | cdc70de628b5 |
line wrap: on
line diff
--- a/core/src/luan/modules/Utils.java Tue Mar 01 07:29:01 2016 -0700 +++ b/core/src/luan/modules/Utils.java Thu Mar 03 12:38:24 2016 -0700 @@ -19,29 +19,49 @@ static final int bufSize = 8192; - private static void checkNotNull(LuanState luan,Object v,String expected) throws LuanException { + private static void checkNotNull(LuanState luan,Object v,String expected,int pos) throws LuanException { if( v == null ) - throw new LuanException(luan,"bad argument #1 ("+expected+" expected, got nil)"); + throw new LuanException(luan,"bad argument #"+pos+" ("+expected+" expected, got nil)"); + } + + public static void checkNotNull(LuanState luan,String s,int pos) throws LuanException { + checkNotNull(luan,s,"string",pos); } public static void checkNotNull(LuanState luan,String s) throws LuanException { - checkNotNull(luan,s,"string"); + checkNotNull(luan,s,1); + } + + public static void checkNotNull(LuanState luan,byte[] b,int pos) throws LuanException { + checkNotNull(luan,b,"binary",pos); } public static void checkNotNull(LuanState luan,byte[] b) throws LuanException { - checkNotNull(luan,b,"binary"); + checkNotNull(luan,b,1); + } + + public static void checkNotNull(LuanState luan,LuanTable t,int pos) throws LuanException { + checkNotNull(luan,t,"table",pos); } public static void checkNotNull(LuanState luan,LuanTable t) throws LuanException { - checkNotNull(luan,t,"table"); + checkNotNull(luan,t,1); + } + + public static void checkNotNull(LuanState luan,Number n,int pos) throws LuanException { + checkNotNull(luan,n,"number",pos); } public static void checkNotNull(LuanState luan,Number n) throws LuanException { - checkNotNull(luan,n,"number"); + checkNotNull(luan,n,1); + } + + public static void checkNotNull(LuanState luan,LuanFunction fn,int pos) throws LuanException { + checkNotNull(luan,fn,"function",pos); } public static void checkNotNull(LuanState luan,LuanFunction fn) throws LuanException { - checkNotNull(luan,fn,"function"); + checkNotNull(luan,fn,1); } public static String readAll(Reader in)