global_map changes if local_map changes
Posted: 02 Dec 2017 10:50
Hello (Martin),
for almost every var the allocation in a script is a call by value allocation. So if you have a expression like this:
the local_var will get the effect of the Function and the global_var not. If global_var is a map the behaviour is diffrent. the global_var will get any effect that local_var will get. So if you add a MapEntry to local_var, then global_var will have this Element too.
Is this a bug or a feature? If this is a feature is there a fast and effective way to create a local_var that isn't linked with the global_var.
If it is a bug and you're going to fix it, can you please implement a way where this link wont't be lost, because I already implemented a few scripts where I use this "bug".
Thanks
for almost every var the allocation in a script is a call by value allocation. So if you have a expression like this:
Code: Select all
local_var = global_var;
anyChangingFunction(local_var)
Is this a bug or a feature? If this is a feature is there a fast and effective way to create a local_var that isn't linked with the global_var.
If it is a bug and you're going to fix it, can you please implement a way where this link wont't be lost, because I already implemented a few scripts where I use this "bug".
Thanks