GUI Style inconsitencies

User avatar
Osmo
Filter Inserter
Filter Inserter
Posts: 294
Joined: Wed Oct 23, 2024 12:08 pm
Contact:

GUI Style inconsitencies

Post by Osmo »

LuaStyle::clicked_vertical_offset is uint32, but documented as int32. Prototype docs are correct.
LuaStyle *_padding and *_margin properties are int16, but documented as int32. Prototype docs are correct, except for ScrollPaneStyleSpecification properties extra_..._when_activated.
ButtonStyleSpecification::draw_grayscale_picture defaults to false. Other optional properties are inherited from parents, and can be mandatory on root styles, but not this one.
User avatar
Therenas
Factorio Staff
Factorio Staff
Posts: 344
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

Re: GUI Style inconsitencies

Post by Therenas »

Thanks for the report, fixed for the next release. The extra ones are indeed 32 bit though, so prototype docs are all correct.

One thing I don't quite get though is your remark about draw_grayscale_picture. I can't see any special handling of that in the code, can you explain what you mean again?
User avatar
Osmo
Filter Inserter
Filter Inserter
Posts: 294
Joined: Wed Oct 23, 2024 12:08 pm
Contact:

Re: GUI Style inconsitencies

Post by Osmo »

Therenas wrote: Wed Apr 22, 2026 7:53 am One thing I don't quite get though is your remark about draw_grayscale_picture. I can't see any special handling of that in the code, can you explain what you mean again?
Most properties of style specifications are marked as optional because properties that are not set are inherited from parent and root styles. And that is documented:
... for root styles, some style properties are mandatory ...
I think font of a LabelStyle is one example, where it is mandatory on the root style.
As they must be specified, they can't have a default value.

But some properties are truly optional, like all the padding and margin properties. They are documented to default to 0. draw_grayscale_picture is also truly optional, but it is not specified what it defaults to.
I think its far from the only such property, but its one i encountered because it can also be set at runtime.
Here's a list of other properties that seem truly optional and don't have default specified, though i haven't verified that is the case:

https://lua-api.factorio.com/latest/typ ... underlined defaults to false
https://lua-api.factorio.com/latest/typ ... aw_borders
https://lua-api.factorio.com/latest/typ ... go_outside
https://lua-api.factorio.com/latest/typ ... r_contents

https://lua-api.factorio.com/latest/typ ... _by_search and https://lua-api.factorio.com/latest/typ ... _by_search, but those aren't really relevant to modders.
User avatar
Therenas
Factorio Staff
Factorio Staff
Posts: 344
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

Re: GUI Style inconsitencies

Post by Therenas »

Ah now I get what you mean, thanks. That is indeed quite underdocumented. I'll make sure to note the default for truly optional properties, and note on the others that they are required at least in the root style. I'll also write down the root style name while I'm at it. It'll be for 2.1 though.
User avatar
Osmo
Filter Inserter
Filter Inserter
Posts: 294
Joined: Wed Oct 23, 2024 12:08 pm
Contact:

Re: GUI Style inconsitencies

Post by Osmo »

Thank you, it'll be useful to have for later. I already figured out most of this for what i'm working on, so i don't mind how long it takes
User avatar
Therenas
Factorio Staff
Factorio Staff
Posts: 344
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

Re: GUI Style inconsitencies

Post by Therenas »

Worked it all out for 2.1, thanks again.
Post Reply

Return to “Resolved Requests”