6 Commits

Author SHA1 Message Date
Celtic Minstrel
e9465fa03e Lua API: Add alternative version of map function to be used on arrays 2021-09-04 22:20:28 -04:00
Celtic Minstrel
b22c3b595c Lua API: Fix functional.map returning the wrong answer if used on a table that contains numeric keys but is not strictly an array 2021-09-04 22:20:28 -04:00
Celtic Minstrel
440dbbd0ad Lua API: The value function is now optional in functional.choose[_map]
By default, the functions now use the value taken directly from the map or array.
In addition, if a string or other non-functional value is passed, it's used as a key on the value.
2021-09-04 22:20:28 -04:00
Celtic Minstrel
29e11e7914 Lua functional library: make reduce accept an operator name in place of a function, add zip 2019-12-07 13:52:49 -05:00
Vasya
fa71ab4be0 Lua API: simplify functional.reduce (#2788)
simplify code and remove `indentity or 0` VS `indentity` inconsistency.

(cherry-picked from commit 2b8782923a758eee2e167e5c4097f2803e6e2be6)
2018-10-07 03:18:38 +00:00
Celtic Minstrel
f6c04e7dd1 Add functional.lua which implements higher-order functions
This covers all the main higher-order functions included in WFL, except zip.
The two already implemented in ai_helper have been replaced with redirection stubs.
2017-05-10 17:40:20 -04:00