Mercurial Hosting > luan
comparison src/luan/modules/BasicLuan.java @ 1389:eb8b35dccd99
cleanup and stringify change
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 03 Sep 2019 22:54:31 -0600 |
parents | 2024d23ddd64 |
children | 59fd2e8b1b9d |
comparison
equal
deleted
inserted
replaced
1388:2024d23ddd64 | 1389:eb8b35dccd99 |
---|---|
253 } else { | 253 } else { |
254 return obj.hashCode(); | 254 return obj.hashCode(); |
255 } | 255 } |
256 } | 256 } |
257 | 257 |
258 public static String stringify(Object obj,String strict) throws LuanException { | 258 public static String stringify(Object obj,LuanTable options) throws LuanException { |
259 boolean b; | |
260 if( strict==null ) { | |
261 b = false; | |
262 } else if( strict.equals("strict") ) { | |
263 b = true; | |
264 } else { | |
265 throw new LuanException("strict must be nil or 'strict'"); | |
266 } | |
267 LuanToString lts = new LuanToString(); | 259 LuanToString lts = new LuanToString(); |
268 lts.strict = b; | 260 if( options != null ) { |
261 Map map = options.asMap(); | |
262 Boolean strict = Utils.removeBoolean(map,"strict"); | |
263 if( strict != null ) | |
264 lts.strict = strict; | |
265 Boolean numberTypes = Utils.removeBoolean(map,"number_types"); | |
266 if( numberTypes != null ) | |
267 lts.numberTypes = numberTypes; | |
268 Utils.checkEmpty(map); | |
269 } | |
269 return lts.toString(obj); | 270 return lts.toString(obj); |
270 } | 271 } |
271 | 272 |
272 private void BasicLuan() {} // never | 273 private void BasicLuan() {} // never |
273 } | 274 } |