refactoring
This commit is contained in:
+2
-1
@@ -38,7 +38,8 @@ do
|
|||||||
end
|
end
|
||||||
|
|
||||||
function private.state.get()
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
+6
-6
@@ -1,5 +1,5 @@
|
|||||||
--green_t = module
|
green_t = module
|
||||||
setglobal('green_t', green_t and error(nil) or module)
|
--setglobal('green_t', green_t and error(nil) or module)
|
||||||
|
|
||||||
local next, setn, type, setmetatable = next, table.setn, type, setmetatable
|
local next, setn, type, setmetatable = next, table.setn, type, setmetatable
|
||||||
local wipe, release, acquire, acquire_temp, empty
|
local wipe, release, acquire, acquire_temp, empty
|
||||||
@@ -12,9 +12,10 @@ CreateFrame('Frame'):SetScript('OnUpdate', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
function wipe(t)
|
function wipe(t)
|
||||||
setmetatable(t, nil); setn(t, 0)
|
setmetatable(t, nil)
|
||||||
for k in t do t[k] = nil end
|
for k in t do t[k] = nil end
|
||||||
t.reset, t.reset = nil, 1
|
t.reset, t.reset = nil, 1
|
||||||
|
setn(t, 0)
|
||||||
return t
|
return t
|
||||||
end
|
end
|
||||||
public.wipe = wipe
|
public.wipe = wipe
|
||||||
@@ -28,7 +29,6 @@ function release(t)
|
|||||||
else
|
else
|
||||||
overflow_pool[t] = true
|
overflow_pool[t] = true
|
||||||
end
|
end
|
||||||
return
|
|
||||||
end
|
end
|
||||||
public.release = release
|
public.release = release
|
||||||
|
|
||||||
@@ -134,6 +134,6 @@ end
|
|||||||
--end
|
--end
|
||||||
|
|
||||||
function public.select(i, ...) temp=arg
|
function public.select(i, ...) temp=arg
|
||||||
while i > 1 do i = i - 1; tremove(arg, i) end
|
while i > 1 do i = i - 1; tremove(arg, i) end
|
||||||
return tremove(arg, 1), unpack(arg)
|
return tremove(arg, 1), unpack(arg)
|
||||||
end
|
end
|
||||||
Reference in New Issue
Block a user