CommandHelper

CommandHelper

46.5k Downloads

@variable permalinked with global register somehow.

LadyCailinBot opened this issue ยท 1 comments

commented

CMDHELPER-2958 - Reported by VergilPrime

http://paste.thezomg.com/14362/43063261/

Here you can see the same code modified very slightly to two different results.

@inv = pinv()
import('inventory')[player()] = @inv

basically these variables are now linked somehow. Changes to @inv occur to import('inventory')[player()] as well.

@inv = array()
import('inventory')[player()] == @inv # returns true.

commented

Comment by LadyCailin

This is not a bug. See example 3 of import/export, and here: http://wiki.sk89q.com/wiki/CommandHelper/Staged/Understanding_References

Arrays are stored by reference. You can always just store a copy of the array, quite easily: export('inventory', array_deep_copy(@inv)), or export('inventory', @inv[]) if the array isn't full of sub-arrays. (array_deep_copy was just added)