How do you create a drop-down list of function input options?

To clarify:

In the Roblox Script Editor, when you type a built-in function like Instance.new(), it displays a sort of drop-down list.

It would be nice to have a drop-down list like this when it comes to certain functions. That way, I don’t have to remember what input is actually valid; but, I’m not quite sure how to replicate this behavior.

I’ve struggled a bit wording this question, and have been unable to find anything on this. Any clue on how to do this?

1 Like

This is done with a type union.

function foo(thing: “One” | “Two”)

I recommend looking up types in Luau. Not at my computer rn, so I can’t provide any links.

4 Likes

Huh. I know about type-checking, but I rarely use type unions, so I guess I just never noticed that it does that. Thank you!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.