All help topics · Link to this topic
Showing help on 'listset()'
Syntax: listset (LIST <list>, <value>, INT <index>) => LISTReturns a copy of <list> with the <index>th element replaced by <value>. If <index> is not in the range `[1..length(<list>)]', then E_RANGE is raised.
x = {"foo", "bar", "baz"};
listset(x, "mumble", 2) => {"foo", "mumble", "baz"}
This function exists primarly for historical reasons; it was used heavily before the server supported indexed assignments like x[i] = v. New code should always use indexed assignment instead of `listset()' wherever possible.