Skip to content

Panicking ByName/IndexOf/IndexByName, separate Try- methods for null/-1 - #2403

Open
BioTomateDE wants to merge 3 commits into
UnderminersTeam:masterfrom
BioTomateDE:trybyname
Open

Panicking ByName/IndexOf/IndexByName, separate Try- methods for null/-1#2403
BioTomateDE wants to merge 3 commits into
UnderminersTeam:masterfrom
BioTomateDE:trybyname

Conversation

@BioTomateDE

Copy link
Copy Markdown
Contributor

The UndertaleData methods and extensions ByName(), IndexOf and IndexOfByName (now called IndexByName) now throw an exception when the element could not be found. The old behavior of returning null/-1 is still available via TryByName, TryIndexOf and TryIndexByName.

Caveats

This is a breaking change.

Notes

i fixed all the csx scripts (hopefully)

@github-actions

Copy link
Copy Markdown

@colinator27 colinator27 added this to the Possible for 0.9.x milestone Jul 2, 2026
@colinator27

Copy link
Copy Markdown
Member

Thinking about wrapping up the design for this, and honestly I'm super hesitant about breaking so many non-builtin scripts that rely on the existing methods...

@BioTomateDE

Copy link
Copy Markdown
Contributor Author

@colinator27 i understand. i still think this would be useful to have in utml in some way tho. maybe the old methods keep their names and the new failable ones could be named Force- or something. or just keep the existing methods and make a bool panic = false argument. what do YOU TWO think?

@colinator27

Copy link
Copy Markdown
Member

@colinator27 i understand. i still think this would be useful to have in utml in some way tho. maybe the old methods keep their names and the new failable ones could be named Force- or something. or just keep the existing methods and make a bool panic = false argument. what do YOU TWO think?

Yeah, that does seem reasonable. I think we would want to make new methods, but I feel like "force" isn't quite the right word... maybe something more like "require"? Not sure...

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