[1.1.88] adding LuaGuiElement of type=slider doesn't immediately respect enabled attribute

This subforum contains all the issues which we already resolved.
commanderguy3001
Burner Inserter
Burner Inserter
Posts: 9
Joined: Sun Jul 30, 2023 7:32 am
Contact:

[1.1.88] adding LuaGuiElement of type=slider doesn't immediately respect enabled attribute

Post by commanderguy3001 »

When adding a new LuaGuiElement of type slider, either through a mod or via command ingame, the slider will disregard the `enabled` attribute when adding it.

Actual behavior: No matter if this attribute is set to true or false, the slider will be enabled in the GUI and will function as if it was enabled.

Expected behaviour: The slider accurately reflects the current setting of the `enabled` attribute at any point in time.

Minimal example to reproduce:
- start a new default settings save file
- run the below code in game in the chat/command line:

Code: Select all

/c
local player=game.player
local gui=player.gui
local screen=gui.screen
local slider = screen.add{
  type="slider",
  name="bugged_slider",
  minimum_value=0,
  maximum_value=10,
  enabled=false
}
This will create a slider in the top left of the screen that the user can interact with despite having `enabled=false`.

To verify if the slider should actually be disabled:

Code: Select all

/c
local player=game.player
local gui=player.gui
local screen=gui.screen
local slider=screen.bugged_slider
game.player.print(slider.enabled)
which outputs `false` as expected.

Workaround to the problem:

Code: Select all

/c
local player=game.player
local gui=player.gui
local screen=gui.screen
local slider=screen.bugged_slider
slider.enabled=false
The above code will disable the slider as expected.
Attachments
factorio-current.log
(4.59 KiB) Downloaded 60 times
Rseding91
Factorio Staff
Factorio Staff
Posts: 14402
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [1.1.88] adding LuaGuiElement of type=slider doesn't immediately respect enabled attribute

Post by Rseding91 »

Thanks for the report. It's now fixed for the next release.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Resolved Problems and Bugs”