String.gsub optional parameter

#1

I noticed the string.gsub documentation mentions the optional fourth parameter, but only as “or the first n, if given,” which could be fixed to be clearer. Also the line with the arguments does not show the 4th parameter at all which can be really confusing to developers. I didn’t know about the 4th parameter and when I looked at the wiki seeing “n, if given” just made me confused. I had to go to the Lua docs to find out what that was which is not ideal.

6 Likes

#2

In general, I think the String documentation needs to be updated. The Lua wiki has examples for (almost) every string function while the roblox wiki doesn’t even have a single example.
Examples are a great thing and the roblox wiki simply does not have enough.
Functions like string.gsub and string.gmatch will be difficult to understand without an example.


I still don’t know how string.gmatch works by just reading the above.
image
The example above is very clear and simple and because of the example above I now unstand string.gmatch.

1 Like

#3

It looks like the descriptions are unchanged from the official Lua site, just without examples. “Iterator function” is definitely a good way to describe gmatch, and it’s the exact definition from the official Lua site; all that’s missing here is an example.

What’s somewhat surprising is that the old Roblox wiki had examples, but that should probably be brought up in a separate request.

1 Like