Merge pull request #3 from andrewlalis/create-pull-request/patch

Changes by create-pull-request action
This commit is contained in:
Andrew Lalis 2022-12-21 12:34:53 +01:00 committed by GitHub
commit a0c1a43a70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -1 +1 @@
a="0.0.1"local b=turtle local c={}local function d(g,h,i)return g~=nil and((not i and g.name==h)or string.find(g.name,h))end local function e(g,h,i)local j={filterFunction=nil,fuzzy=h or false,whitelist=i}if type(g)=="string"then j.filterFunction=function(k,l)local m=d(k,g,l.fuzzy)if l.whitelist then return m else return not m end end elseif type(g)=="table"then j.filterFunction=function(k,l)for m,n in pairs(g)do if l.whitelist and d(k,n,l.fuzzy)then return true elseif not l.whitelist and not d(k,n,l.fuzzy)then return false end end return not l.whitelist end elseif type(g)=="function"then j.filterFunction=g end j.apply=function(k)return j.filterFunction(k,j)end return j end function c.totalCount(g)local h=0 for i=1,16 do local j=b.getItemDetail(i)if g.apply(j)then h=h+j.count end end return h end function c.select(g)for h=1,16 do local i=b.getItemDetail(h)if g.apply(i)then b.select(h)return true end end return false end local function f(g,h)for i=1,16 do local j=b.getItemDetail(i)if h.apply(j)then b.select(i)g()end end end function c.dropAll(g)f(b.drop,g)end function c.dropAllDown(g)f(b.dropDown,g)end function c.dropAllUp(g)f(b.dropUp,g)end function c.organize()error("Not yet implemented.")end return c a="0.0.1"local b=turtle local c={}local function d(f,g,h)return f~=nil and((not h and f.name==g)or string.find(f.name,g))end function c.makeFilter(f,g,h)local i={filterFunction=nil,fuzzy=g or false,whitelist=h}if type(f)=="string"then i.filterFunction=function(j,k)local l=d(j,f,k.fuzzy)if k.whitelist then return l else return not l end end elseif type(f)=="table"then i.filterFunction=function(j,k)for l,m in pairs(f)do if k.whitelist and d(j,m,k.fuzzy)then return true elseif not k.whitelist and not d(j,m,k.fuzzy)then return false end end return not k.whitelist end elseif type(f)=="function"then i.filterFunction=f end i.apply=function(j)return i.filterFunction(j,i)end return i end function c.totalCount(f)local g=0 for h=1,16 do local i=b.getItemDetail(h)if f.apply(i)then g=g+i.count end end return g end function c.select(f)for g=1,16 do local h=b.getItemDetail(g)if f.apply(h)then b.select(g)return true end end return false end local function e(f,g)for h=1,16 do local i=b.getItemDetail(h)if g.apply(i)then b.select(h)f()end end end function c.dropAll(f)e(b.drop,f)end function c.dropAllDown(f)e(b.dropDown,f)end function c.dropAllUp(f)e(b.dropUp,f)end function c.organize()error("Not yet implemented.")end return c