I got fed up of writing basic table functions over and over again, so I packaged them up and put them on the Asset Portal at:
https://www.defold.com/community/projects/101547/
It is licensed under the UnLicense, a.k.a. it’s public domain and you can do whatever you like.
It’s also on GitHub at https://github.com/ShriekBob/DefTable
It has the following functions:
List Like Tables
- index_of
- for_each
- for_each_with_index
- map
- fold_left
- fold_right
- filter
- partition
- zip
- stitch
- all
- any
- member
- max
- min
- sum
- product
Hash Like Tables
- key_of
- index_of
- for_each
- map
- reduce
- filter
- partition
- all
- any
- is_key
- is_value
- keys
- values
If you spot any awful bugs, or have any issues (or if I’m not following some best practice) just let me know