Mercurial Hosting > luan
comparison src/luan/modules/BasicLuan.java @ 1553:26c51acf00f3
improve stringify
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 06 Oct 2020 19:31:57 -0600 |
parents | 46d4baaad64d |
children | e1a13e707bf3 |
comparison
equal
deleted
inserted
replaced
1552:46d4baaad64d | 1553:26c51acf00f3 |
---|---|
207 } else { | 207 } else { |
208 return obj.hashCode(); | 208 return obj.hashCode(); |
209 } | 209 } |
210 } | 210 } |
211 | 211 |
212 public static String stringify(Object obj,LuanTable options) throws LuanException { | 212 public static String stringify(Object obj,LuanTable options,LuanTable subOptions) throws LuanException { |
213 LuanToString lts = new LuanToString(); | 213 LuanToString lts = new LuanToString(options,subOptions); |
214 if( options != null ) { | |
215 options = new LuanTable(options); | |
216 Boolean strict = Utils.removeBoolean(options,"strict"); | |
217 if( strict != null ) | |
218 lts.strict = strict; | |
219 Boolean numberTypes = Utils.removeBoolean(options,"number_types"); | |
220 if( numberTypes != null ) | |
221 lts.numberTypes = numberTypes; | |
222 Boolean compressed = Utils.removeBoolean(options,"compressed"); | |
223 if( compressed != null ) | |
224 lts.compressed = compressed; | |
225 Boolean useLongStrings = Utils.removeBoolean(options,"use_long_strings"); | |
226 if( useLongStrings != null ) | |
227 lts.useLongStrings = useLongStrings; | |
228 LuanTable longStringKeys = Utils.removeTable(options,"long_string_keys"); | |
229 if( longStringKeys != null ) | |
230 lts.longStringKeys = new HashSet(longStringKeys.asList()); | |
231 Utils.checkEmpty(options); | |
232 } | |
233 return lts.toString(obj); | 214 return lts.toString(obj); |
234 } | 215 } |
235 | 216 |
236 public static String json_string(Object obj,LuanTable options) throws LuanException { | 217 public static String json_string(Object obj,LuanTable options) throws LuanException { |
237 JsonToString jts = new JsonToString(); | 218 JsonToString jts = new JsonToString(); |