mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-21 14:53:44 +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 = {}
|
||||
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, ...)
|
||||
local args = { ... }
|
||||
@ -73,6 +73,8 @@ end
|
||||
|
||||
-- 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 sub(a, b) return a - b end
|
||||
|
Loading…
Reference in New Issue
Block a user