Commit bc6dd55e authored by nanahira's avatar nanahira

avoid using corouting

parent fedca703
......@@ -35,9 +35,9 @@ function Auxiliary.PreloadUds()
e2:SetCode(EFFECT_FORBIDDEN)
e2:SetTargetRange(0xff,0xff)
e2:SetTarget(function(e,c)
local code1,code2=c:GetOriginalCodeRule()
local codes={c:GetOriginalCodeRule()}
return _.any(_FORBID_LIST,function(m)
return (code1==m.code or code2==m.code) and (not c:IsOnField() or c:GetTurnID()>=m.turn)
return _.include(codes,m.code) and (not c:IsOnField() or c:GetTurnID()>=m.turn)
end)
end)
Duel.RegisterEffect(e2,p)
......
......@@ -37,12 +37,11 @@ end
function Underscore.iter(list_or_iter)
if type(list_or_iter) == "function" then return list_or_iter end
return coroutine.wrap(function()
for i=1,#list_or_iter do
coroutine.yield(list_or_iter[i])
end
end)
local pair_iter=ipairs(list_or_iter)
return function()
local placeholder,res=pair_iter()
return res
end
end
function Underscore.range(start_i, end_i, step)
......@@ -51,11 +50,11 @@ function Underscore.range(start_i, end_i, step)
start_i = 1
end
step = step or 1
local range_iter = coroutine.wrap(function()
for i=start_i, end_i, step do
coroutine.yield(i)
end
end)
local list = {}
for i=start_i, end_i, step do
table.insert(list,i)
end
local range_iter = Underscore.iter(list)
return Underscore:new(range_iter)
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment