Mercurial Hosting > luan
comparison src/luan/modules/BasicLuan.java @ 1623:582384548a69
LuanToString takes function
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 01 Aug 2021 18:59:01 -0600 |
parents | fa066aaa068c |
children | 164c6ea53147 |
comparison
equal
deleted
inserted
replaced
1622:b7f8418fb7ba | 1623:582384548a69 |
---|---|
209 } else { | 209 } else { |
210 return obj.hashCode(); | 210 return obj.hashCode(); |
211 } | 211 } |
212 } | 212 } |
213 | 213 |
214 public static String stringify(Luan luan,Object obj,LuanTable options,LuanTable subOptions) throws LuanException { | 214 public static String stringify(Luan luan,Object obj,Object options) throws LuanException { |
215 LuanToString lts = new LuanToString(options,subOptions); | 215 if( options == null ) |
216 lts.luan = luan; | 216 return new LuanToString(luan).toString(obj); |
217 return lts.toString(obj); | 217 if( options instanceof LuanTable ) |
218 return new LuanToString(luan,(LuanTable)options).toString(obj); | |
219 if( options instanceof LuanFunction ) | |
220 return new LuanToString(luan,(LuanFunction)options).toString(obj); | |
221 throw new LuanException("options must be table of function"); | |
218 } | 222 } |
219 | 223 |
220 public static String json_string(Object obj,LuanTable options) throws LuanException { | 224 public static String json_string(Object obj,LuanTable options) throws LuanException { |
221 JsonToString jts = new JsonToString(); | 225 JsonToString jts = new JsonToString(); |
222 if( options != null ) { | 226 if( options != null ) { |