mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-22 07:13:45 +01:00
Add func.identity
This commit is contained in:
parent
8b538587ad
commit
d72e589a62
8
func.lua
8
func.lua
@ -6,11 +6,11 @@ local modlib, unpack, select, setmetatable
|
|||||||
local _ENV = {}
|
local _ENV = {}
|
||||||
setfenv(1, _ENV)
|
setfenv(1, _ENV)
|
||||||
|
|
||||||
no_op = function() end
|
function no_op() end
|
||||||
|
|
||||||
-- TODO fix this being ugly AF
|
function identity(...) return ... end
|
||||||
|
|
||||||
-- TODO switch all of these to vargs
|
-- TODO switch all of these to proper vargs
|
||||||
|
|
||||||
function curry(func, ...)
|
function curry(func, ...)
|
||||||
local args = { ... }
|
local args = { ... }
|
||||||
@ -73,6 +73,8 @@ end
|
|||||||
|
|
||||||
-- Functional wrappers for Lua's builtin metatable operators (arithmetic, concatenation, length, comparison, indexing, call)
|
-- Functional wrappers for Lua's builtin metatable operators (arithmetic, concatenation, length, comparison, indexing, call)
|
||||||
|
|
||||||
|
-- TODO (?) add operator table `["+"] = add, ...`
|
||||||
|
|
||||||
function add(a, b) return a + b end
|
function add(a, b) return a + b end
|
||||||
|
|
||||||
function sub(a, b) return a - b end
|
function sub(a, b) return a - b end
|
||||||
|
Loading…
Reference in New Issue
Block a user