Page 1 of 1

Style booleans - "on" vs "true"

Posted: Tue Oct 01, 2019 6:58 pm
by moon69
hi,

I'm confused about the following style properties...
LuaStyle.horizontally_stretchable
LuaStyle.stretch_image_to_widget_size

Both are defined boolean, but horizontally_stretchable expects "on" and stretch_image_to_widget_size expects true.

Code: Select all

local style = data.raw["gui-style"].default

style.style_Beast_button_stretch =
{
    type = "button_style",
    horizontally_stretchable = "on",
}

style.style_test_image =
{
    type = "image_style",
    stretch_image_to_widget_size = true,
}
The above code works, but if I change horizontally_stretchable to true, I get load error:
Unknown stretch rule value

Why is this!?

Re: Style booleans - "on" vs "true"

Posted: Tue Oct 01, 2019 7:38 pm
by Bilka
moon69 wrote:
Tue Oct 01, 2019 6:58 pm
hi,

I'm confused about the following style properties...
LuaStyle.horizontally_stretchable
LuaStyle.stretch_image_to_widget_size

Both are defined boolean, but horizontally_stretchable expects "on" and stretch_image_to_widget_size expects true.

Why is this!?
Because you're looking at the doc for runtime scripting but applying it to the data stage. Here is the data stage doc: https://wiki.factorio.com/Types/StyleSp ... tretchable - the property has 3 options, so it is a string.

Re: Style booleans - "on" vs "true"

Posted: Wed Oct 02, 2019 1:16 pm
by moon69
Thanks Bilka.