godotengine / godotengine/godot-docs

OptionButton: negative id's shouldn't be allowed if -1 is treated as no-id

Open
#8,464 4 comments 0 reactions 0 assignees View on GitHub
area:class reference bug discussion
Dominant language
reStructuredText
Stars
5.7k
Forks
3.8k
Avg merge
1d 20h
Merged PRs (30d)
25

Description

v4.2.beta.custom_build [64150060f]

In the OptionButton, you shouldn't be allowed to use negative numbers, as -1 is used as a special value.

```
void add_item(label: String, id: int = -1)

Adds an item, with text label and (optionally) id. If no id is passed, the item index will be used as the item's ID. New items are appended at the end.
```

So if you use **role_selector.add_item("none", -1)**, "none" will have an id based int the item index. But the docs say:

`Note: The ID values used for items are limited to 32 bits, not full 64 bits of int. This has a range of -2^32 to 2^32 - 1, i.e. -2147483648 to 2147483647.`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.