Изменения

+ str.rep
Строка 428: Строка 428:  
     local str2 = frame.args[2] or '';
 
     local str2 = frame.args[2] or '';
 
     return str._strcmp(str1 , str2)
 
     return str._strcmp(str1 , str2)
 +
end
 +
 +
--[[
 +
    simple function to pipe string.rep to templates.
 +
]]
 +
 +
function str.rep( frame )
 +
    local repetitions = tonumber( frame.args[2] )
 +
    if not repetitions then
 +
        return str._error( 'функция rep ожидает число  во втором параметре, а получено "' .. ( frame.args[2] or '' ) .. '"' )
 +
    end
 +
    return string.rep( frame.args[1] or '', repetitions )
 
end
 
end
  
Анонимный участник