refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-08-23 08:14:22 +02:00
parent c2f7311349
commit 99ba3e7fdc
15 changed files with 51 additions and 41 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ function public:complete_filter()
local filter_string = this:GetText()
local completed_filter_string = ({strfind(filter_string, '([^;]*)/[^/;]*$')})[3]
local _, suggestions = filter.query(completed_filter_string or '')
local _, suggestions = filter_util.query(completed_filter_string or '')
local start_index, _, current_modifier = strfind(filter_string, '([^/;]*)$')
current_modifier = current_modifier or ''
+12 -7
View File
@@ -42,6 +42,7 @@ do
local arg1 = arg
return function(...) return helper(body, arg1, arg) end
else
error(debugstack(1, 10))
body = gsub(body, '_([ab])', function(char) return '_'..a1b2[char] end)
local lambda = loadstring 'return function(_1,_2,_3,_4,_5,_6,_7,_8,_9)'..f..' end'
setfenv(lambda, getfenv(2))
@@ -51,11 +52,15 @@ do
end
function public.call(f, ...) temp=arg
if f then return f(unpack(arg)) end
if f then
return f(unpack(arg))
end
end
function public.index(t, ...) temp=arg
for i=1,arg.n do t = t and t[arg[i]] end
for i=1,arg.n do
t = t and t[arg[i]]
end
return t
end
@@ -105,12 +110,12 @@ function public.select(i, ...) temp=arg
return tremove(arg, 1), unpack(arg)
end
function public.collect(t, ...) temp=arg
local T = T
for _, v in t do
tinsert(T, arg[v])
function public.collect(indices, ...) temp=arg
local t = _m.t
for _, v in indices do
tinsert(t, arg[v])
end
return T
return t
end
function public.hashset(t)
+5 -1
View File
@@ -1,4 +1,8 @@
module 'filter'
module 'filter_util' import 'info' 'cache'
function LOAD()
import 'cache'
end
function default_filter(str)
return {
+1 -1
View File
@@ -75,7 +75,7 @@ function public.item_query(item_id, first_page, last_page)
local item_info = info.item(item_id)
if item_info then
local query = filter.query(item_info.name..'/exact')
local query = filter_util.query(item_info.name..'/exact')
query.blizzard_query.first_page = first_page
query.blizzard_query.last_page = last_page
return {