• Hey! Guest! The 40th (!!!) GMC Jam will take place between February 25th, 12:00 UTC to March 1st 12:00 UTC. Why not join in this very special anniversary jam! Click here to find out more!

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

Pixel-Team

Member
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

Member
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

Member
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