Switch to edit mode.
Name(s): from_value1: "$string_utils:from_value(value [, quote_strings = 0 [, list_depth = 1]])"
2: "Print the given value into a string."
3: {value, ?quote_strings = 0, ?list_depth = 1} = args
4: if (typeof(value) == $LIST)
5: if (value)
6: if (list_depth)
7: result = "{" + this:from_value(value[1], quote_strings, list_depth - 1)
8: for v in (listdelete(value, 1))
9: result = tostr(result, ", ", this:from_value(v, quote_strings, list_depth - 1))
10: $cmd_utils:suspend_if_needed()
11: endfor
12: return result + "}"
13: else
14: return "{...}"
15: endif
16: else
17: return "{}"
18: endif
19: elseif (quote_strings)
20: if (typeof(value) == $STR)
21: result = "\""
22: while (q = index(value, "\"") || index(value, "\\"))
23: if (value[q] == "\"")
24: q = min(q, index(value + "\\", "\\"))
25: endif
26: result = result + value[1..q - 1] + "\\" + value[q]
27: value = value[q + 1..$]
28: endwhile
29: return result + value + "\""
30: elseif (typeof(value) == $ERR)
31: return $code_utils:error_name(value)
32: else
33: return tostr(value)
34: endif
35: else
36: return tostr(value)
37: endif
38: "Last modified by Dax (#789) on Tue May 3 13:45:56 2005 MDT."