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)
