TableKit | A fully-typed, optimized for Luau kit for table manipulation & utility | v0.1.1

TableKit

TableKit is a kit of functions to help manipulate & utilize tables more effectively. It contains various functions that have real-world use cases such as .Reconcile(), .DeepCopy(), .Every(), .ToString(), and a lot more. It’s pure- it consists of completely pure functions. You can just drag it in, and use it. Just like it was designed for.

GitHub

Documentation

https://ffrostflame.github.io/TableKit/

Get it


Why?

I made this project primarily because there were no up-to-date & high-quality table manipulation libraries out there. None suited my needs- I wanted something I could plug in with Wally, something fully typed and using modern-day Luau functions. This doesn’t exist.

Advantages

  • This is mainly for my personal usage- which means that it will be updated any time I need a new feature.
  • I use it in my open source packages (at the moment, 2 unreleased) as well.
  • It’s up-to-date with Luau features. This means it uses generic iteration, all of the built-in table functions, etc.
  • It’s fully typed.
  • It’s completely tested- check the GitHub repository to see the test code.

Disadvantages

  • This package doesn’t have as many features as other packages do, like .Sync(), .Flat(), .Map(), etc.
  • It’s another dependency for your project. However, if you’re going to do these yourself, you might as well use this.

Prior Art / Inspiration

  • TableUtils by sleitnick
  • Javascript Array objects- you’ll see a few things taken from there such as .Unshift().
10 Likes

Does this support mini tennis tables

other than that this is a pretty neat resource

3 Likes

i see potential but ToString is literally table.concat

table.concat cannot print things like oo classes, so things like heartbeat connections, functions, etc. will error.

1 Like

With the DeepCopy function, is there any difference with table.clone()?

I was doing a small skim over the code and would just like to mention that doing a generic like this:

<T>(something: T): T

Is probably not what you want to do when working with table generics, table types are treated funky, but Luau will think the cloned table is the input and not a clone of it.

As I said, table generics are a bit of hassle to get working so I cant provide an immediate solution

1 Like

table.clone does shallow copying- not deep copying.

I don’t think there is a solution sadly.

This is cool! I have worked on something like this before which wasn’t as known. Full integration of JavaScript Array functions would be cool!

1 Like

0.2.1

  • Updated all string manipulation to use new Luau string interpolation
  • .ToString() improvements
  • General improvements (thanks @Someone-dQw4w9WgXcQ)
  • Typo fix (@Carrotoplia)