garrysmod icon indicating copy to clipboard operation
garrysmod copied to clipboard

String lib update

Open Kefta opened this issue 8 years ago • 8 comments

  • 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.

Kefta avatar Sep 05 '17 11:09 Kefta

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.

BlackCetha avatar Sep 07 '17 09:09 BlackCetha

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.

Kefta avatar Sep 07 '17 11:09 Kefta

Conflicts resolved

Kefta avatar Jan 26 '18 22:01 Kefta

What needs to be done to see this change merged?

Kefta avatar Dec 01 '21 22:12 Kefta

Conflicts right now

GitSparTV avatar Dec 01 '21 22:12 GitSparTV

I mean other than that. It sat for years without conflict.

Kefta avatar Dec 01 '21 22:12 Kefta

Anim lib is also awaiting : )

GitSparTV avatar Dec 01 '21 22:12 GitSparTV

Spam @robotboy655

thegrb93 avatar Dec 01 '21 23:12 thegrb93