Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combobox return nil #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

BardaAvishunden
Copy link

Fixed an nil value on the combobox default value

Fixed an nil value on the combobox default value
@warxander
Copy link
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
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
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
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