Skip to content

[ENHANCEMENT] Optional scripted enum arguments - #575

Merged
AbnormalPoof merged 1 commit into
FunkinCrew:developfrom
NotHyper-474:feat/switch-matching-and-enums
Oct 31, 2026
Merged

AbnormalPoof merged 1 commit into
FunkinCrew:developfrom
NotHyper-474:feat/switch-matching-and-enums

Conversation

@NotHyper-474

Copy link
Copy Markdown
Contributor

This PR allows enum arguments to be optional using the ?name:Type syntax, also allowing switch case enum matching to specify null as a value as a quick way to check for an argument that was passed null (or not passed at all).

enum Foo
{
  Aab(yes:String, ?no:String);
}

var foo = Foo.Aab('ok');
switch (foo)
{
  case Aab(yes, null):
    trace('Got Aab with Yes: "$yes"');
  case Aab(yes): // Directly equivalent to the one above
  case Aab(yes, no): // Doesn't run because the order matters (that's the behavior on actual Haxe: https://try.haxe.org/#7dbb3855)
    trace('Got Aab with Yes: "$yes" and No: "$no"');
  default:
}

@AbnormalPoof
AbnormalPoof merged commit 39ff883 into FunkinCrew:develop Oct 31, 2026
9 checks passed
@NotHyper-474
NotHyper-474 deleted the feat/switch-matching-and-enums branch October 31, 2026 10:40
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