Skip to content

Combobox return nil#25

Open
BardaAvishunden wants to merge 1 commit into
warxander:masterfrom
BardaAvishunden:master
Open

Combobox return nil#25
BardaAvishunden wants to merge 1 commit into
warxander:masterfrom
BardaAvishunden:master

Conversation

@BardaAvishunden

Copy link
Copy Markdown

Fixed an nil value on the combobox default value

Fixed an nil value on the combobox default value
@warxander

Copy link
Copy Markdown
Owner

What's the purpose of this change?
API is designed that you store starting current index explicitly and pass it to widget function.

@BardaAvishunden

Copy link
Copy Markdown
Author

Only purpose is ease of use. Didnt want to put all my default values in when opening the menu, also not "resetting" settings when opening cus values getting called.

@warxander

Copy link
Copy Markdown
Owner

Please provide some more details.
Because as I understand, the UI state is managed in the following way:

local state = { }

-- Reset state to default
-- Call it on script init and when menu was closed or just opened
function resetState()
  state.index = 1
end

-- Menu loop
local _, state.index = WarMenu.ComboBox('Text', items, state.index)

warxander added a commit that referenced this pull request Jul 2, 2024
@BardaAvishunden

Copy link
Copy Markdown
Author

If defualt states is not set when opening the menu the combobox will return nil. This is just ease of use so you dont have to set default values and potentially not being able to set settings cus the get reset when opening the menu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants