test my exemple code: https://go.dev/play/p/G7LxjDNjNAn
terminal result:
&{0}
&{1}
how i want output from example terminal
&{1}
&{1}
my code in project:
func Set(recv *Value, value Value) {
reflect.ValueOf(recv).Elem().Set(reflect.ValueOf(value))
}
func (this *SetBlock) On_Exec(locals map[string]Value) {
//this.inputs["Recv"].Value is pointing to the same value as global
if this.inputs["Recv"].Value != nil {
Set(&this.inputs["Recv"].Value, this.inputs["Value"].Value.Copy())
}
//this.layer.Game.Globals() is a original
fmt.Println(this.layer.Game.Globals())
this.outputs["After"].Value = Create_Bool(true)
}
I'm here because I don't even know how to research this.
have change in A and B. whoever helped me with the "Set" function sent a code. Hope you send too. For some reason it worked, now it doesn't.
I can't assign to the map, because this function was made in such a way that I cannot even know if the value comes from an array if it is a variable or a map tag
the "Set" function works for different types https://go.dev/play/p/TggxPxF5kx9
one way i'm sure would work is to create a pointer pointer, not being a map pointer, a pointer that points to the pointer that points to the value of the 2 maps
the "Set" function is based on setting the pointer to the other pointer. I think the error is that I'm pointing to the wrong pointer
I conceived, when creating the value I create two pointers to that value, that is ** and that way to change. thanks: @JimB