[1.1.88] adding LuaGuiElement of type=slider doesn't immediately respect enabled attribute
Posted: Sun Jul 30, 2023 8:11 am
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:
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:
which outputs `false` as expected.
Workaround to the problem:
The above code will disable the slider as expected.
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
}
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)
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