sourcemod icon indicating copy to clipboard operation
sourcemod copied to clipboard

Add mark/info about all optional parameters

Open birgersp opened this issue 3 years ago • 1 comments

Help us help you

  • [x] I have checked that my issue doesn't exist yet.
  • [x] I have tried my absolute best to reduce the problem-space and have provided the absolute smallest test-case possible.
  • [x] I can always reproduce the issue with the provided description below.

Environment

(This is about the online docs, local env not relevant)

Description

It would be helpful for SourceMod scripters like myself, if the API (docs) were more explicit about which properties are optional or not.

For instance, the StringMap.SetValue Method makes no mention that the replace parameter is actually optional (as far as I can tell).

In my personal opinion, every optional parameter of every function in the entire SourceMod API (or any API for that matter) should be explicitly marked as "optional" in the API docs.

image

StringMap sm = new StringMap();
// bool SetValue(const char[] key, any value, bool replace)
sm.SetValue("x", 123); // <--- this compiles and runs just fine, even though the "replace" parameter is not set

birgersp avatar Nov 30 '22 09:11 birgersp

I'd suggest using sourcemod.dev instead.

asherkin avatar Nov 30 '22 09:11 asherkin