Draycos Goldaryn
Member
I'm having a problem. I'm trying to create a scene that will load a data object and edit it similar to the Database editor, however I'm adding things to the class, so I need a different editor. I'm just running into a problem detecting if a change has been made. as seen in my example below, $actor != $actor_copy will always return false.
How do I copy an object and edit the copy without changing the original? for example:
[rgss]$actor = RPG::Actor.new
$actor_copy = $actor
$actor_copy.id = 1
p $actor.id, $actor_copy.id #=> returns [1, 1]. I want it to be [0, 1]
[/rgss]
And before you suggest it, $actor_copy = $actor.clone or $actor_copy = $actor.dup does the same as the example, except $actor != $actor_copy will always return true, even if I don't make a change to either.
How do I copy an object and edit the copy without changing the original? for example:
[rgss]$actor = RPG::Actor.new
$actor_copy = $actor
$actor_copy.id = 1
p $actor.id, $actor_copy.id #=> returns [1, 1]. I want it to be [0, 1]
[/rgss]
And before you suggest it, $actor_copy = $actor.clone or $actor_copy = $actor.dup does the same as the example, except $actor != $actor_copy will always return true, even if I don't make a change to either.