overextended / ox_lib

A FiveM resource and script library for Lua and JS.
https://overextended.dev/ox_lib
GNU Lesser General Public License v3.0
282 stars 378 forks source link

(Feat)Add table.length function #604

Closed Luke20201 closed 1 week ago

Luke20201 commented 1 week ago

LUA doesn't have this, and I thought it'd be nice for a FiveM library to have it so I committed to ox.

thelindat commented 1 week ago

Well #tbl for actual length (assuming an continuous array without gaps). For hashmaps I'd rather a specialised class (like array) with methods for such things.

Luke20201 commented 1 week ago

Well #tbl for actual length (assuming an continuous array without gaps). For hashmaps I'd rather a specialised class (like array) with methods for such things.

I used a for loop assuming there would be instances of gaps in the data(i.e framework player list)