Module:Core

Revision as of 21:37, 7 February 2019 by がか (talk | contribs) (Created page with "local Core = {} -- * Function functions. function Core.id(x) return x end -- * Collection functions. function Core.find(tbl, v_, k_) for _, v in pairs(tbl) do if k...")

Documentation for this module may be created at Module:Core/doc

local Core = {}

-- * Function functions.

function Core.id(x)
  return x
end

-- * Collection functions.

function Core.find(tbl, v_, k_)
  for _, v in pairs(tbl) do
    if k_ and v and v[k_] == v_ or not k_ and v == v_ then
      return v
    end
  end
  return false
end

return Core