Here’s a function I wrote a minute ago:
Here’s the code complete that I get for it:
I can’t remember the args my function takes (and in what order) and I wrote it a minute ago. It would be really really helpful if Studio would remind me what the argument list is when I call the function.
In Visual Studio I get these reminders for all of the overloads of a function and it saves infinite time flipping between source files. In Lua if I mistype an arg list, I might not even find out until runtime, so if anything, it’s more important in Roblox to have this.
I’m not even asking for types. Just tell me what the arg list is.
As a partial workaround, you can right-click on the function call and click “Go to declaration”.
As for how you handle arguments, I would recommend you use the
assert statement at the top of most functions that accept arguments, to check arguments are what you expect.
assert checks whether the first argument is true, and if not, then it errors with the text from the second argument.
It’s not pretty, but it saved me a ton of time figuring out logical errors.
An example of doing this:
function module.SetCharacterStatus(char, status)
assert(typeof(char) == "Instance" and char:IsA("Model"), "Argument 1 must a Model Instance.")
assert(typeof(status) == "string", "Argument 2 must a string.")
-- Do whatever.
Going to wait on types rather than assert all my stuff. Asserting only helps a little. The biggest problem is that your code will give runtime errors. With a type system those would be caught before the code runs, saving lots of time.
It’s even more aggravating that Studio knows what the definition of my function is (since it can jump to it with Ctrl + F12) but doesn’t show me the declaration inline as I type. Seems like very low hanging fruit.