diff src/luan/modules/BasicLuan.java @ 1420:225808b90cee

options handling
author Franklin Schmidt <fschmidt@gmail.com>
date Sat, 26 Oct 2019 22:21:09 -0600
parents 59fd2e8b1b9d
children 9ab267b9427c
line wrap: on
line diff
--- a/src/luan/modules/BasicLuan.java	Fri Oct 25 22:12:06 2019 -0600
+++ b/src/luan/modules/BasicLuan.java	Sat Oct 26 22:21:09 2019 -0600
@@ -259,17 +259,17 @@
 	public static String stringify(Object obj,LuanTable options) throws LuanException {
 		LuanToString lts = new LuanToString();
 		if( options != null ) {
-			Map map = options.asMap();
-			Boolean strict = Utils.removeBoolean(map,"strict");
+			options = new LuanTable(options);
+			Boolean strict = Utils.removeBoolean(options,"strict");
 			if( strict != null )
 				lts.strict = strict;
-			Boolean numberTypes = Utils.removeBoolean(map,"number_types");
+			Boolean numberTypes = Utils.removeBoolean(options,"number_types");
 			if( numberTypes != null )
 				lts.numberTypes = numberTypes;
-			Boolean compressed = Utils.removeBoolean(map,"compressed");
+			Boolean compressed = Utils.removeBoolean(options,"compressed");
 			if( compressed != null )
 				lts.compressed = compressed;
-			Utils.checkEmpty(map);
+			Utils.checkEmpty(options);
 		}
 		return lts.toString(obj);
 	}
@@ -277,11 +277,11 @@
 	public static String json_string(Object obj,LuanTable options) throws LuanException {
 		JsonToString jts = new JsonToString();
 		if( options != null ) {
-			Map map = options.asMap();
-			Boolean compressed = Utils.removeBoolean(map,"compressed");
+			options = new LuanTable(options);
+			Boolean compressed = Utils.removeBoolean(options,"compressed");
 			if( compressed != null )
 				jts.compressed = compressed;
-			Utils.checkEmpty(map);
+			Utils.checkEmpty(options);
 		}
 		return jts.toString(Luan.toJava(obj));
 	}