From 216cdf799a2c3207e63bd051eb16a6e6e72f66e2 Mon Sep 17 00:00:00 2001 From: andrewlalis Date: Wed, 21 Dec 2022 14:01:03 +0000 Subject: [PATCH] [create-pull-request] automated change --- min/itemscript.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/min/itemscript.lua b/min/itemscript.lua index e6bbdd6..998ad87 100644 --- a/min/itemscript.lua +++ b/min/itemscript.lua @@ -1 +1 @@ -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 \ No newline at end of file +a="0.0.1"local b=turtle local c={}local function d(k,l,m)return k~=nil and((not m and k.name==l)or string.find(k.name,l))end local function e(k)return function(l)return not k(l)end end local function f(k)return function(l)for m,n in pairs(k)do if not n(l)then return false end end return true end end local function g(k)return function(l)for m,n in pairs(k)do if n(l)then return true end end return false end end local function h(k)local l,m=string.find(k,"^[!#]+")local n=false local o=false if l~=nil then for q=l,m do local r=string.sub(k,q,q)if r=="!"then o=true elseif r=="#"then n=true end end k=string.sub(k,m+1,string.len(k))end local p=string.find(k,":")if p==nil and not n then k="minecraft:"..k end return function(q)if q==nil then return false end local r=d(q,k,n)if o then r=not r end return r end end local function i(k)if type(k)=="table"and#k>0 and type(k[1])=="string"then local l={}for m,n in pairs(k)do table.insert(l,h(n))end return g(l)elseif type(k)=="string"then return h(k)elseif type(k)=="function"then return k else error("Unsupported filter type: "..type(k))end end function c.totalCount(k)local l=i(k)local m=0 for n=1,16 do local o=b.getItemDetail(n)if l(o)then m=m+o.count end end return m end function c.select(k)local l=i(k)for m=1,16 do local n=b.getItemDetail(m)if l(n)then b.select(m)return true end end return false end local function j(k,l)for m=1,16 do local n=b.getItemDetail(m)if l(n)then b.select(m)k()end end end function c.dropAll(k)j(b.drop,i(k))end function c.dropAllDown(k)j(b.dropDown,i(k))end function c.dropAllUp(k)j(b.dropUp,i(k))end function c.organize()error("Not yet implemented.")end return c \ No newline at end of file -- 2.34.1