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