Mercurial Hosting > luan
comparison core/src/luan/modules/BasicLuan.java @ 442:75ccb4da803f
move assert() implementation to luan
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 04 May 2015 13:49:12 -0600 |
parents | d9df6d6cb927 |
children | bf5e62a9090c |
comparison
equal
deleted
inserted
replaced
441:aedb90df53ce | 442:75ccb4da803f |
---|---|
117 | 117 |
118 public static void error(LuanState luan,Object msg) throws LuanException { | 118 public static void error(LuanState luan,Object msg) throws LuanException { |
119 throw luan.exception(msg); | 119 throw luan.exception(msg); |
120 } | 120 } |
121 | 121 |
122 public static Object assert_(LuanState luan,Object v,String msg) throws LuanException { | |
123 if( Luan.toBoolean(v) ) | |
124 return v; | |
125 if( msg == null ) | |
126 msg = "assertion failed!"; | |
127 throw luan.exception( msg ); | |
128 } | |
129 | |
130 public static String assert_string(LuanState luan,String v) throws LuanException { | 122 public static String assert_string(LuanState luan,String v) throws LuanException { |
131 Utils.checkNotNull(luan,v); | 123 Utils.checkNotNull(luan,v); |
132 return v; | 124 return v; |
133 } | 125 } |
134 | 126 |