Mercurial Hosting > luan
diff src/luan/LuanException.java @ 1283:503bde9a7c80
add luan.require() and table.call()
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 21 Dec 2018 09:12:09 -0700 |
parents | 2531942abaf3 |
children | f41919741100 |
line wrap: on
line diff
--- a/src/luan/LuanException.java Thu Dec 20 17:44:34 2018 -0700 +++ b/src/luan/LuanException.java Fri Dec 21 09:12:09 2018 -0700 @@ -33,27 +33,10 @@ public LuanTable table(LuanState luan) { if( table==null ) { - table = new LuanTable(luan); - table.rawPut( "java", this ); - LuanTable metatable = new LuanTable(luan); - table.setMetatable(metatable); try { - table.rawPut( "get_message", new LuanJavaFunction( - LuanException.class.getMethod( "getMessage" ), this - ) ); - table.rawPut( "throw", new LuanJavaFunction( - LuanException.class.getMethod( "throwThis" ), this - ) ); - table.rawPut( "get_stack_trace_string", new LuanJavaFunction( - LuanException.class.getMethod( "getLuanStackTraceString" ), this - ) ); - table.rawPut( "get_java_stack_trace_string", new LuanJavaFunction( - LuanException.class.getMethod( "getJavaStackTraceString" ), this - ) ); - metatable.rawPut( "__to_string", new LuanJavaFunction( - LuanException.class.getMethod( "__to_string", LuanTable.class ), this - ) ); - } catch(NoSuchMethodException e) { + LuanTable Boot = (LuanTable)luan.require("luan:Boot.luan"); + table = (LuanTable)Boot.call( "new_error_table", this ); + } catch(LuanException e) { throw new RuntimeException(e); } } @@ -64,10 +47,6 @@ throw this; } - public String __to_string(LuanTable ignore) { - return getLuanStackTraceString(); - } - public String getJavaStackTraceString() { return getJavaStackTraceString(this); }