changeset 1612:8852f34a646a

bug fix
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 23 May 2021 15:17:25 -0600
parents f67f972bd648
children 92beba8bf1c8
files src/luan/modules/parsers/LuanToString.java
diffstat 1 files changed, 30 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
diff -r f67f972bd648 -r 8852f34a646a src/luan/modules/parsers/LuanToString.java
--- a/src/luan/modules/parsers/LuanToString.java	Sat May 15 17:24:07 2021 -0600
+++ b/src/luan/modules/parsers/LuanToString.java	Sun May 23 15:17:25 2021 -0600
@@ -126,40 +126,40 @@
 				throw new LuanException("can't handle metatables when strict");
 			if( luan==null )
 				throw new LuanException("can't handle metatables when luan isn't set");
-		}
-		LuanFunction pairs = luan.getHandlerFunction("__pairs",tbl);
-		if( pairs != null ) {
-			sb.append( '{' );
-			boolean first = true;
-			for( Object obj : tbl.iterable(luan) ) {
-				Map.Entry entry = (Map.Entry)obj;
-				if( settings.compressed ) {
-					if( first )
+			LuanFunction pairs = luan.getHandlerFunction("__pairs",tbl);
+			if( pairs != null ) {
+				sb.append( '{' );
+				boolean first = true;
+				for( Object obj : tbl.iterable(luan) ) {
+					Map.Entry entry = (Map.Entry)obj;
+					if( settings.compressed ) {
+						if( first )
+							first = false;
+						else
+							sb.append( ',' );
+					} else if( settings.inline ) {
+						if( first ) {
+							first = false;
+							sb.append( ' ' );
+						} else
+							sb.append( ", " );
+					} else {
 						first = false;
-					else
-						sb.append( ',' );
-				} else if( settings.inline ) {
-					if( first ) {
-						first = false;
+						indent(sb,indented+1);
+					}
+					toString(entry,sb,indented+1,settings);
+				}
+				if( !first ) {
+					if( settings.compressed ) {
+					} else if( settings.inline ) {
 						sb.append( ' ' );
-					} else
-						sb.append( ", " );
-				} else {
-					first = false;
-					indent(sb,indented+1);
+					} else {
+						indent(sb,indented);
+					}
 				}
-				toString(entry,sb,indented+1,settings);
+				sb.append( '}' );
+				return;
 			}
-			if( !first ) {
-				if( settings.compressed ) {
-				} else if( settings.inline ) {
-					sb.append( ' ' );
-				} else {
-					indent(sb,indented);
-				}
-			}
-			sb.append( '}' );
-			return;
 		}
 		List list = tbl.asList();
 		Map map = tbl.rawMap();