Writing to the property first prevents the crash.
Reproduction:
Code: Select all
script.on_event(defines.events.on_player_created, function(event)
local player = game.players[event.player_index]
local t = player.gui.screen.add{type="table", column_count=1}
local _ = t.style.horizontal_spacing -- 💥 Factorio crashes here
end)