I noticed something weird with arrays, and I'm not sure what's up. Whether it's a bug, whether I'm not understanding something about how arrays work, or whatever, idk.. 馃
Setup:
- Create a new GMS2 project
- Import GMLive.gml, place obj_gmlive in the room
- Create a new object, place it in the room
- Create event of the object:
if (live_call()) return live_result; a[0] = "foo"; b = a; b[0] = "bar"; show_debug_message("a[0] = " + a[0] + ", b[0] = " + b[0]);
- Step event of the object:
if keyboard_check_pressed(vk_space) room_restart();
What happens:
- If live_enabled is set to 0 (i.e. live reloading not enabled), a[0] = foo, b[0] = bar shows up in the output console when the game is run, as well as whenever spacebar is pressed to restart the room. This is the behaviour I am expecting.
- If live_enabled is set to 1, a[0] = foo, b[0] = bar shows up in the output console when the game is run, but whenever the room is restarted, it now somehow becomes a[0] = bar, b[0] = bar, as if the array is suddenly getting passed by reference or something?