- Welcome to the Kancolle Wiki!
- If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord
Difference between revisions of "Module:Core"
Jump to navigation
Jump to search
(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...") |
m |
||
Line 1: | Line 1: | ||
− | local | + | local Module = {} |
-- * Function functions. | -- * Function functions. | ||
− | function | + | function Module.id(x) |
return x | return x | ||
end | end | ||
Line 9: | Line 9: | ||
-- * Collection functions. | -- * Collection functions. | ||
− | function | + | function Module.find(tbl, v_, k_) |
for _, v in pairs(tbl) do | for _, v in pairs(tbl) do | ||
if k_ and v and v[k_] == v_ or not k_ and v == v_ then | if k_ and v and v[k_] == v_ or not k_ and v == v_ then | ||
Line 18: | Line 18: | ||
end | end | ||
− | return | + | return Module |
Revision as of 21:38, 7 February 2019
Documentation for this module may be created at Module:Core/doc
local Module = {}
-- * Function functions.
function Module.id(x)
return x
end
-- * Collection functions.
function Module.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 Module