[теллина верси][теллина верси]
Чулацам дӀабаьккхина Чулацам тӀетоьхна
Нисдарах лаьцна йаздина дац
Нисдарах лаьцна йаздина дац
МогӀа 16:
end
 
function M['.forall'] = function(fframe)-- Итератор по нумерованным аргументам вызывающего шаблона.
local template = frame.args[1]
-- f.args[1] — имя вызываемого шаблона.
local separator = frame.args.separator or ''
local tf,ac,res,tln,sep,gl=f:getParent(),{},{},f.args[1]:match('^%s*([^#]-)%s*#(.*)$'),tonumber(f.args[2]) or 1;
local conjunction = frame.args.conjunction or separator
if not tln then tln,sep=f.args[1]:match('^%s*(.-)%s*$'),'' end
for p,k in pairs(f.args) do if type(p)=='string' then ac[p]=k end end
local results = {}
local ans,i,ablk={},1;
for param, value in while tfpairs(frame:getParent().args[i]) do
if type(param) == 'number' then
if gl==1 then
ans results[iparam] = tfframe:expandTemplate{ title =tln; template, args = {tf.args[i], unpack(ac)value} }
end
else
end
ablk={}; for j = 0, gl-1 do ablk[j] = tf.args[i*gl+j] end;
return mw.text.listToText( results, separator, conjunction )
for k,v in pairs(ac) do ablk[k]=v end;
ans[i] = tf:expandTemplate{ title=tln; args=ablk }
end
i = i+1
end
return table.concat(ans,sep)
end