Closed eAi closed 3 years ago
What you have there is correct syntax for Enum
properties. It's implemented here: https://github.com/rojo-rbx/rojo/blob/master/src/resolution.rs#L47
Reading your question more closely: token
is just the name of the element used for Enum
values in the XML format. It's probably best to not read too much into the XML format; it contains quite a lot of inconsistencies and strangeness. A glaring example is that these element names are in fact totally irrelevant semantically. You can change them to complete gibberish and Roblox Studio will still parse the file correctly :D
@kennethloeffler Thanks for that explanation. The tricky thing with Rojo is that it seems as though you do have to read the xml and translate that into JSON to make certain things work. As someone fairly new to this, knowing what to look at and what not to is a bit tricky. Ideally there would be a big list of all the properties and an explanation of them so you don’t need to read the xml file - but I appreciate they’re liable to change at any point.
Thanks for filing this issue, I think this is a good datapoint for something we can improve in Rojo.
I think a lot of folks don't even know that enums are called "tokens" in the XML format. I think it's super weird that they are.
I'm going to go ahead and close this issue as it appears resolved. We should add a documentation section that explains how to write properties of every type for future users.
If we want to change, say, the avatar type, it seems as though the way to do this is to do this:
I'm at a bit unused why (or if) this works. The underlying property in the rbxlx file is a Token property that has a numeric value:
<token name="GameSettingsAvatar">1</token>
But settings this as a numeric value in the rojo project causes Rojo to error saying that the type is ambiguous. The token property type itself isn't supported, so explicitly specifying this just tells you that.
I can't find anything in the code that explains what a token property is (it seems to be an enum value?) or how this is handled by rojo or the underlying libraries. The only way I worked this out was by finding this: https://github.com/rojo-rbx/rojo/blob/c7ab6c435c3b66b7fa857ebb5553f262f9fbbe01/test-projects/script-unwritable/default.project.json and I'm not sure if this is actually correct.
We've made this work for now, but I'd be interested to know why this works and if we should document it anywhere?