diff core/src/luan/LuanMeta.java @ 416:91af5337b9ae

add LuanMeta.__tostring()
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 30 Apr 2015 06:28:25 -0600
parents ce8e19567911
children dae264ad6a7b
line wrap: on
line diff
--- a/core/src/luan/LuanMeta.java	Thu Apr 30 06:04:17 2015 -0600
+++ b/core/src/luan/LuanMeta.java	Thu Apr 30 06:28:25 2015 -0600
@@ -45,10 +45,17 @@
 		throw new UnsupportedOperationException();
 	}
 
+	protected abstract String type(LuanTable tbl);
+
+	public String __tostring(LuanState luan,LuanTable tbl) throws LuanException {
+		return type(tbl) + "-" + tbl;
+	}
+
 	public LuanTable newMetatable() {
 		LuanTable mt = new LuanTable();
 		mt.put( "__index", this );
 		mt.put( "__pairs", this );
+		mt.put( "__tostring", this );
 		if( canNewindex() )
 			mt.put( "__newindex", this );
 		return mt;