• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Windows readonly vars used in struct allowed when compiling with VM but not YYC

Pixel-Team

Master of Pixel-Fu
I am making a node-based text graph utility that outputs a JSON file containing each node and its data, including id, text, speaker, child_node_list, etc. One of the variables of the node struct uses one of GML's built-in variables "id," except in my struct, it is not readonly, it is read/write. It works just fine when I compile for VM, but when I switch to YYC, I get the following error:

Script: NodeStruct at line 28 : assignment to read only variable

Why is it ok to borrow one of the built-in variables and use it in this way in VM, but not in YYC? My problem is that I don't want to have to rename this variable to be _id, or it will be the only variable in the JSON output that uses an underscore. Any help would be appreciated.
 

FrostyCat

Redemption Seeker
This issue looks resolved in GMS 2.3.1. I can run the following on Windows YYC just fine:
GML:
strc = {
    foo: "bar",
    id: "baz",
};
show_message(strc);
 

Pixel-Team

Master of Pixel-Fu
It looks like the YYC compiler has problems if the vars are used within a struct constructor, like this:
GML:
function GUIElement(_GUIElementController) constructor {
    
    foo            = bar;
    id            = undefined;
}
I tried this both in Gamemaker Studio 2.3 and the Beta.
 
Last edited:
Top