refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-09-05 10:26:04 +02:00
parent 7355cd90b6
commit 9a94641b28
2 changed files with 8 additions and 7 deletions
+2 -1
View File
@@ -38,7 +38,8 @@ do
end
function private.state.get()
for _, state in scan_states do if state.id == thread_id then return state end end
local _, state = next(filter(copy(scan_states), function(state) return state.id == thread_id end))
return state
end
end
+6 -6
View File
@@ -1,5 +1,5 @@
--green_t = module
setglobal('green_t', green_t and error(nil) or module)
green_t = module
--setglobal('green_t', green_t and error(nil) or module)
local next, setn, type, setmetatable = next, table.setn, type, setmetatable
local wipe, release, acquire, acquire_temp, empty
@@ -12,9 +12,10 @@ CreateFrame('Frame'):SetScript('OnUpdate', function()
end)
function wipe(t)
setmetatable(t, nil); setn(t, 0)
setmetatable(t, nil)
for k in t do t[k] = nil end
t.reset, t.reset = nil, 1
setn(t, 0)
return t
end
public.wipe = wipe
@@ -28,7 +29,6 @@ function release(t)
else
overflow_pool[t] = true
end
return
end
public.release = release
@@ -134,6 +134,6 @@ end
--end
function public.select(i, ...) temp=arg
while i > 1 do i = i - 1; tremove(arg, i) end
return tremove(arg, 1), unpack(arg)
while i > 1 do i = i - 1; tremove(arg, i) end
return tremove(arg, 1), unpack(arg)
end