If the standard layer argument matches an existing layer, the current
layer is set to that layer. Otherwise, a new layer is created, if
possible, and the current layer is set to the new layer. The function
will fail if it is not possible to create a new layer, for example if
the name is not a valid layer name.
If the name is not in the layer:purpose form, any
new layer created will use the default ``drawing'' purpose.
The return value is the 1-based index of the previous current layer in
the layer table, or 0 if there was no current layer. This return can
be passed as the argument to revert to the previous current layer.