[Functions] _ Function modifying Object sent as Parameter (Bug?) Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
User
Posts: 144
Joined: 26 Jun 2017, 08:12

[Functions] _ Function modifying Object sent as Parameter (Bug?)

20 Jul 2018, 21:09

Hi,

In the example below, the "f()" function modifies the "x" object sent as parameter when it is called!

Is this a bug?

Code: [Select all] [Expand] [Download] (Untitled.ahk)GeSHi © Codebox Plus



Partial Solution:

Code: [Select all] [Expand] [Download] (Untitled.ahk)GeSHi © Codebox Plus

Last edited by User on 20 Jul 2018, 23:18, edited 1 time in total.
User avatar
Flipeador
Posts: 962
Joined: 15 Nov 2014, 21:31
GitHub: Flipeador
Location: Argentina
Contact:

Re: [Functions] _ Function modifying Object sent as Parameter (Bug?)

20 Jul 2018, 21:24

Windws 1♂ Pro 64-Bits I make scripts for AHKv2 (my v2 compiler) & WIN_7+ Spanish Argentina SublimeText 3 & AHKv2 My GDI+ Library
User
Posts: 144
Joined: 26 Jun 2017, 08:12

Re: [Functions] _ Function modifying Object sent as Parameter (Bug?)

20 Jul 2018, 22:05



Do you happen to know how to create\clone a new object from the object referenced by a variable?
User avatar
Flipeador
Posts: 962
Joined: 15 Nov 2014, 21:31
GitHub: Flipeador
Location: Argentina
Contact:

Re: [Functions] _ Function modifying Object sent as Parameter (Bug?)  Topic is solved

20 Jul 2018, 22:16

Windws 1♂ Pro 64-Bits I make scripts for AHKv2 (my v2 compiler) & WIN_7+ Spanish Argentina SublimeText 3 & AHKv2 My GDI+ Library
User
Posts: 144
Joined: 26 Jun 2017, 08:12

Re: [Functions] _ Function modifying Object sent as Parameter (Bug?)

20 Jul 2018, 22:23



Sorry about my ignorance related to this but, "Returns a shallow copy of the object", that "shallow" what does it mean in this context?

I see no further explanations from the link!
User
Posts: 144
Joined: 26 Jun 2017, 08:12

Re: [Functions] _ Function modifying Object sent as Parameter (Bug?)

20 Jul 2018, 22:43



Well, I will mark "Object.Clone()" as a solution for this! (A "shallow" solution, I may say!)

Thanks for helping!

(Obs:) I updated the main post of this thread with a partial solution!

Return to “Ask For Help”

Who is online

Users browsing this forum: nonvenomous and 51 guests