We need more built-in table operations

I know this isn’t a feature request forum, but I still cannot post there despite my participation.

I’m going to get straight to the point. I work with data preprocessing a lot, and I’ve noticed ROBLOX’s Lua table API is rather lacking compared to NumPy. There are some common list operations I think need to be integrated into the language to prevent developers from reinventing the wheel.

A very simple example is list reversal.

A more complicated, but quite useful operation is NumPy’s unique function.

Is there a public repo with some unimplemented Lua functions that I can copy and paste into my workspace as module scripts?

1 Like

that actually gave me an idea to make some extinctions to the current table

2 Likes

In case anyone needs a basic implementation of the unique function, I wrote one up for module scripts.

return function(tab)
	local uniques = {}
	table.foreachi(tab,function(i,v)
		if not table.find(uniques,v) then
			table.insert(uniques,v)
		end
	end)
	return uniques
end
1 Like

Still think this needs more attention.
I have to rewrite the argmin, argmax, argsort operations in each of my games and then dedicate some folder to storing them in each game. It would be nice if we could get a more mature API for data structures as it would appear to me that most developers are reinventing these common operations.