Differences From
Artifact [47c34e0cc8]:
- File
lib/tbl.lua
— part of check-in
[ea6e475e44]
at
2020-10-19 09:52:11
on branch trunk
— continue dev on celestial mechanics, add melding+division spells (resonance), refine itemclasses, add keypunch and punchcards, add paper pulp, add a shitload of visuals, add convenience scripts for working with the wiki, make the flamebolt spell actually useful instead of just a pretty lightshow, add essences, inferno crystal, and other goodies; iterate on wands, lots of shit i can't remember, various bugfixes
(user:
lexi,
size: 3607)
[annotate]
[blame]
[check-ins using]
90 90 return new
91 91 end
92 92
93 93 fn.capitalize = function(str)
94 94 return string.upper(string.sub(str, 1,1)) .. string.sub(str, 2)
95 95 end
96 96
97 -fn.has = function(tbl,value)
97 +fn.has = function(tbl,value,eqfn)
98 98 for k,v in pairs(tbl) do
99 - if value == v then return true, k end
99 + if eqfn then
100 + if eqfn(v,value,tbl) then return true, k end
101 + else
102 + if value == v then return true, k end
103 + end
100 104 end
101 105 return false, nil
102 106 end
103 107
104 108 fn.keys = function(lst)
105 109 local ks = {}
106 110 for k,_ in pairs(lst) do