Commit Graph

391 Commits

Author SHA1 Message Date
David Briscoe
5b4d1c16c5 tablex: Skip equality comparison in equal fn
The second loop doesn't care if the values are equal. It only checks if
the keys are there. The first loop already checked for equality.

Add tests to prove correctness using testy.lua.
2022-03-03 10:04:28 -08:00
David Briscoe
585ba82e57 async: Use function to capture ...
Instead of only capturing 8 temps, pass resume to a function so we can
capture all returned values as ...

I might be missing a reason why you wouldn't do it like this.

Test
    -- coro is an async() updated in love.update
    coro:call(
        function()
            coro.wait(1)

            print("jump")
            self.gravity.y = -900
            coro.wait(1)

            print("fall")
            self.gravity.y = 900
            coroutine.yield "hello"

            return "done"
        end,
        nil,
        function(...)
            print("complete", ...)
        end)
2022-03-03 00:08:19 -08:00
Max Cahill
f6a18380d4
Merge pull request #50 from Sheepolution/patch-3
Return table in foreach for chaining
2022-03-01 13:02:27 +11:00
Sheepolution
f36946ace4
Add comment to foreach regarding new behaviour 2022-03-01 03:01:39 +01:00
Sheepolution
3c6aaf1a76
Return table in foreach for chaining 2022-03-01 02:03:33 +01:00
Max Cahill
0fdddab5b9
Merge pull request #49 from Sheepolution/patch-2
Don't have inplace methods return a new sequence
2022-02-24 11:05:22 +11:00
Sheepolution
6df4b4bddd
Don't have inplace methods return a new sequence 2022-02-22 05:01:27 +01:00
Max Cahill
8fd402b125 Merge #48 - functional.splat 2022-01-25 10:23:07 +11:00
Max Cahill
aec62d92ec moved functional.splat below functional.map_inplace, reformatted a little 2022-01-25 10:22:28 +11:00
Jeremy S. Postelnek
fd998c8525
Update functional.lua 2022-01-24 16:40:46 -05:00
Jeremy S. Postelnek
a9b699afdd
Update functional.lua 2022-01-24 16:27:49 -05:00
Jeremy S. Postelnek
120c9658fc
Update functional.lua 2022-01-23 13:20:02 -05:00
Max Cahill
c0847e1955 fixed intersect.bounce_off bouncing if the velocity was already going away from the normal 2022-01-20 17:37:40 +11:00
Max Cahill
658c8e7117 fixed mathx.ease_inout 2022-01-18 13:15:54 +11:00
Max Cahill
0be82a31df fixed sequence missing a few functional methods 2022-01-17 17:05:59 +11:00
Max Cahill
18347e0b72
Merge pull request #47 from TurtleP/TurtleP/stringx_max_split
[Enhancement]: add optional `max_split` to `stringx.split`
2021-12-31 08:44:35 +11:00
TurtleP
2ef834d538 max_split -> limit, allow zero limit 2021-12-26 11:32:43 -05:00
Jeremy S. Postelnek
e5d00ef3a7
clarify the non-zero *and* positive error 2021-12-24 13:23:37 -05:00
Jeremy S. Postelnek
b01ba8e506
fix spacing 2021-12-24 13:19:38 -05:00
Jeremy S. Postelnek
23bc392b6e
check for negative max_split value 2021-12-24 13:19:12 -05:00
Jeremy S. Postelnek
660ae8ca52
add max_split to stringx.split 2021-12-24 13:03:36 -05:00
Max Cahill
2d5555400d fixed pretty print depth issues 2021-11-26 16:50:44 +11:00
Max Cahill
e731a167d8 added tablex.shallow_equal and tablex.deep_equal, slow functions for content-based (in)equality of different tables 2021-11-23 11:40:31 +11:00
Max Cahill
72cb14b8ec Merge branch feature/tablex.pick_weighted_random
minor changes to error handling and docs
2021-11-23 10:58:56 +11:00
Max Cahill
f3e299e3c9 fixed pubsub using set but not requiring it (breaks without :export())
fixes #44
2021-11-23 10:45:09 +11:00
Max Cahill
f5eda744b9 clarified declaration of h in colour.rgb_to_hsl
fixes #43
2021-11-23 10:41:09 +11:00
Max Cahill
5df717fe6d used mathx for clamp01 in intersect
fixes #45
2021-11-23 10:25:09 +11:00
Jesse Viikari
a42f1190e0 Modified weighted random pick function
- Now accepts a table from which it will pick the random value from,
  instead of an index
- Changed function name to better reflect the way it now works
2021-11-19 10:03:40 +02:00
Max Cahill
7767802433 chased down more math vs mathx usage (and actually fixed the random_lerp usage) 2021-11-19 15:35:52 +11:00
Max Cahill
4460a94933 mathx.random_lerp calls mathx.lerp instead of math.lerp so it works without exported globals
fixes #41
2021-11-19 15:28:54 +11:00
Max Cahill
6ce0dfa523 fixed wrong inequality :) 2021-11-18 15:18:58 +11:00
Max Cahill
774965a508 added async.wait for waiting for a certain period of time inside an async task 2021-11-18 15:15:48 +11:00
Max Cahill
31bfe92d37 added todo for tablex.weighted_random, removed returning the weight value as multi-return wasn't documented and could break in some circumstances 2021-11-18 10:35:26 +11:00
Max Cahill
7aa476a58c
Merge pull request #40 from speakk/weighted_random
Add a weighted random pick for tablex
2021-11-18 10:25:48 +11:00
Jesse Viikari
7eb6bcc576 Add a weighted random pick for tablex 2021-11-17 20:20:04 +02:00
Max Cahill
63a1cf5438 Merge PR #39: add ripairs
minor: touched up whitespace/naming/comments
2021-11-11 13:47:24 +11:00
Max Cahill
8aa6107056 made tablex relative require consistent with other modules 2021-11-11 13:42:03 +11:00
Westerbly Snaydley
cf8e0ac81a add ripairs (reverse ipairs) 2021-11-09 23:45:01 -05:00
Max Cahill
65d8f24a45
Merge pull request #38 from radgeRayden/master
Fix intersect depending on exported mathx
2021-10-26 10:06:40 +11:00
Westerbly Snaydley
271d079bbb Fix intersect depending on exported mathx 2021-10-24 18:32:14 -05:00
Max Cahill
0629e349a4 Merge remote-tracking branch 'origin/master' 2021-10-22 12:40:29 +11:00
Max Cahill
bbc34ddb5b added measure.lua benchmarking helpers - todo ones that aid inline profiling, probably just wrapping some code and measuring time/memory deltas each run 2021-10-22 12:40:23 +11:00
Max Cahill
50053b6674
Merge pull request #37 from Sheepolution/patch-1
Fix parameter/argument name mismatch
2021-10-21 13:13:44 +11:00
Max Cahill
1d430bd6a9 added todo note about auto-pooling 2021-10-19 15:41:40 +11:00
Sheepolution
95269b3362
Fix parameter/argument name mismatch 2021-10-19 03:04:55 +02:00
Max Cahill
c10338fa5d Added (more helpful) error on first use rather than on require when missing bitops library for colour.pack/unpack methods
fixes https://github.com/1bardesign/batteries/issues/35
2021-10-19 11:48:16 +11:00
Max Cahill
5b49cbdc17 Added installation note about package.loaded and LUA_PATH for init.lua
fixes https://github.com/1bardesign/batteries/issues/36
2021-10-19 11:35:18 +11:00
Max Cahill
0eda6e8262 added functional.chain for conveniently mapping things like node paths and vector splines 2021-10-15 12:49:31 +11:00
Max Cahill
eae1849c16 fixed filter_inplace doesn't return anything, thanks sheepolution 2021-10-12 11:51:17 +11:00
Max Cahill
0ebe5b1e9f added async.stall to canonicalise the stalling mechanism for async users 2021-10-08 16:17:18 +11:00