1 line
1.2 KiB
Lua
1 line
1.2 KiB
Lua
|
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
|