Commit Graph

28 Commits

Author SHA1 Message Date
Max Cahill
0691f2bd36 added tablex.random_index 2021-07-06 08:29:45 +10:00
Max Cahill
1de942daa8 Use luajit table.clear properly
Fixes #25
2021-06-29 14:46:40 +10:00
Max Cahill
9b95643e6e Added tablex.swap_and_pop 2021-06-09 19:49:04 +10:00
DUznanski
2846de2ea3
Fix shuffle to avoid bias
There's a subtle trick in shuffling: you should draw only from the part of the deck you have not seen!  Otherwise, some permutations are more common than others.
2021-05-20 12:33:52 -07:00
Max Cahill
a397d3d7f8 Merge remote-tracking branch 'origin/master' 2021-05-11 11:00:10 +10:00
Max Cahill
f343c1c0b7 [modified] optimised table.insert_sorted and made it _actually_ insert at the back of the range instead of at the first equal found position (not always the same) 2021-05-11 10:59:59 +10:00
Max Cahill
89ecd4258e Merge remote-tracking branch 'origin/master'
# Conflicts:
#	tablex.lua
2021-05-04 21:07:35 +10:00
Max Cahill
5cd33398a5 [added] tablex.swap 2021-05-04 20:52:47 +10:00
Max Cahill
bc7754ae0b [modified] minor refactor of how tablex.clear is or isn't initialised as needed 2021-05-04 10:38:31 +10:00
Max Cahill
826a2797c8 [modified] refactored insert_sorted to get PR #18 merged 2021-04-30 11:46:51 +10:00
Alvaro Frias Garay
5ed6d68f6c added binary search to insert_sorted
Added method tablex.is_sorted
2021-04-15 21:09:04 -03:00
Max Cahill
16c183ec31 [added] tablex.take_random which is like pick_random but removes the element 2021-03-09 20:07:41 +11:00
Max Cahill
24bcc78616 [added] tablex.append_inplace and tablex.append can both take variable numbers of tables 2021-03-05 12:07:28 +11:00
Max Cahill
5f124be2f0 [added] tablex.trim to trim a table to a certain length 2020-08-24 20:54:43 +10:00
Max Cahill
18d02434a0 [added] tablex.flatten as an alias for collapse 2020-07-02 17:04:47 +10:00
Max Cahill
284856d2c3 [modified] refactored init.lua extensively; used new assert module in stringx and tablex 2020-05-19 12:03:45 +10:00
Max Cahill
f183a1a485 [fixed] a few wrong assert strings 2020-05-12 14:14:08 +10:00
Max Cahill
b91f4f1fcc [added] tablex.collapse to reduce the dimensionality of a table; caveats on some edge case behaviour documented 2020-04-29 20:57:05 +10:00
Max Cahill
e75147ec77 [modified] moved tablex.stringify to stringx.pretty 2020-04-17 10:45:15 +10:00
Max Cahill
6bf6113dc2 [added] quoted strings in tablex.stringify; todo consider moving it to stringx actually, as it works for non-table types, maybe as stringx.pretty... 2020-04-17 10:34:39 +10:00
Max Cahill
d445c170e1 [added] tablex.insert_sorted (does what you'd expect, though no binary search yet) 2020-04-14 21:52:33 +10:00
Max Cahill
7922cd3912 [modified] table.push and table.unshift return the table for possible chaining 2020-04-14 13:53:10 +10:00
Max Cahill
b570ea7096 [added] tablex.front and tablex.key_of 2020-04-10 14:14:15 +10:00
Max Cahill
a87380f43c [modified] moved dedupe from functional to tablex 2020-04-08 21:18:52 +10:00
Max Cahill
f214be9f59 [added] tostring awareness for tablex.stringify 2020-04-08 21:10:24 +10:00
Max Cahill
c191a7b4f6 [fixed] issue loading tablex without love 2020-04-08 20:51:16 +10:00
Max Cahill
8d5da0a9ff [modified] moved append and append_inplace from functional to tablex 2020-04-08 20:50:51 +10:00
Max Cahill
6386aaf298 [modified] big refactor to localised modules and require("batteries"):export() for global usage; renamed files table to tablex and math to mathx to allow using the library in your module root if you really want to. 2020-04-07 13:49:10 +10:00