garrysmod
garrysmod copied to clipboard
String lib update
-
Localised global/library functions to the top. A majority of these were already done for string.Explode (and was accepted into the codebase before), so I just moved them to the top for the rest of the functions to use and added a few more. While I don't normally promote this for typical coding practice due to more mess than gain, I feel it is appropriate for a core library.
-
Removed "documentation" comments. They were outdated and inconsistent; many functions didn't even have one. Keeping up the documentation in the core files alongside the wiki is useless.
-
string metatable's __index will now check for numbers before functions. This means doing string[#] = "blah" -- in reference to the global string table, will no longer break string character accessing for the specific number.
-
Fixed string.GetExtensionFromFilename returning nil when there's no extension.
-
Added withpattern to string.Split.
-
string.FormattedTime and string.NiceTime no longer accept nil -- this wasn't documented and didn't make sense in how it was handled.
-
string.NiceSize now supports TBs.
-
string.NiceTime now properly handles negative/zero values.
-
Minor optimisations/code cleanup where applicable. Primary optimisation was making no string functions call __index internally.
Yay for the idea, but is this tested?
It seems to me that there is an 'end' statement missing in line 62 (green side of the diff). Makes be believe it isn't tested.
This is tested. The diff always tries to condense the changes, so it will grab an end from an unrelated function if there's no additions between, which is the case at 62.
Conflicts resolved
What needs to be done to see this change merged?
Conflicts right now
I mean other than that. It sat for years without conflict.
Anim lib is also awaiting : )
Spam @robotboy655