Mercurial Hosting > luan
diff 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 |
line wrap: on
line diff
--- a/src/luan/modules/BasicLuan.java Tue Sep 03 22:12:53 2019 -0600 +++ b/src/luan/modules/BasicLuan.java Tue Sep 03 22:54:31 2019 -0600 @@ -255,17 +255,18 @@ } } - public static String stringify(Object obj,String strict) throws LuanException { - boolean b; - if( strict==null ) { - b = false; - } else if( strict.equals("strict") ) { - b = true; - } else { - throw new LuanException("strict must be nil or 'strict'"); + 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"); + if( strict != null ) + lts.strict = strict; + Boolean numberTypes = Utils.removeBoolean(map,"number_types"); + if( numberTypes != null ) + lts.numberTypes = numberTypes; + Utils.checkEmpty(map); } - LuanToString lts = new LuanToString(); - lts.strict = b; return lts.toString(obj); }