[2.0.76] line gui element stretchability doesn't persist across save-load cycle
Posted: Tue Mar 17, 2026 12:35 pm
Creating a new line gui element for some reason sets horizontally_stretchable on its style to true. This is probably relevant, though technically not a bug, but i don't see a good reason why this isn't just a property on the default style instead of what seems like an in-engine exception, given it also cannot be read from the LuaStyle.
If horizontally_stretchable is set to false by a mod, the element correctly becomes not stretchable. Writing nil later (importantly, needs to be at a different time) doesn't restore it back to stretchable since this is not what its LuaStyle nor style specification says it should do. The observed result is that the line has a width of 0 and cannot be seen.
Create a new world with the code below in control.lua to see this behaviour.
If the game is then saved, exited and loaded again, the line becomes stretchable and can be seen, which is incorrect.
Create a new world with the code below in control.lua to see this behaviour.
If the game is then saved, exited and loaded again, the line becomes stretchable and can be seen, which is incorrect.
Code: Select all
script.on_event(defines.events.on_player_created, function(event)
storage.player_index = event.player_index
local player = game.get_player(event.player_index)
local frame = player.gui.screen.add{
type = "frame", name = "frame",
style = "inside_shallow_frame_with_padding",
}
frame.auto_center = true
frame.style.width = 448
frame.style.height = 200
local flow = frame.add{type = "flow", name = "flow", direction = "vertical"}
flow.style.vertical_spacing = 8
flow.add{type = "button"}
local line = flow.add{type = "line", name = "line"}
game.print(line.style.horizontally_stretchable) -- prints nil
line.style.horizontally_stretchable = false
end)
script.on_event(defines.events.on_tick, function(event)
if event.tick == 2 then
local player = game.get_player(storage.player_index)
local line = player.gui.screen.frame.flow.line
line.style.horizontally_stretchable = nil
end
end)