ID:198426
 
Keywords: copy, help, objlists
(See the best response by Robertbanks2.)
is there a way to copy a obj/example and put in to the same list? I tried making a new one and setting all its options but it never appears in the list.
Best response
Look up the list procs Copy(), Insert(), Add(), and Find().

mob/verb/CopyListElement()
var/list/NewList = L.Copy(1,1)
L.Add(E)

obj/example
New()
L.Add(src)

var/list/L = new()


I think something like this is the general idea you're looking for. This should copy the first element of the list L, then add it back into L, creating a duplicate /obj/example. You could extend the functionality further by adding verb arguments to CopyListElement() to allow the user to select which element to copy, or automate the process with Find().