Module:Loop: Difference between revisions
forgot to grab 3rd arg in repi |
No edit summary |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 16: | Line 16: | ||
local text = frame.args[3]; | local text = frame.args[3]; | ||
if not index_var then | if not index_var then | ||
return | return p._error( 'function repi expects a string as first parameter, received "' .. ( frame.args[1] or '' ) .. '"' ) | ||
end | end | ||
if not repetitions then | if not repetitions then | ||
return | return p._error( 'function repi expects a number as second parameter, received "' .. ( frame.args[2] or '' ) .. '"' ) | ||
end | end | ||
if not text then | if not text then | ||
return | return p._error( 'function repi expects a string to repeat as third parameter, received "' .. ( frame.args[3] or '' ) .. '"' ) | ||
end | end | ||
str = '' | str = '' | ||
| Line 29: | Line 29: | ||
end | end | ||
return str | return str | ||
end | |||
--[[ | |||
Helper function to handle error messages. | |||
]] | |||
function p._error( error_str ) | |||
local frame = mw.getCurrentFrame() | |||
local error_str = '<strong class="error">Loop Module Error: ' .. error_str .. '</strong>' | |||
return error_str | |||
end | end | ||
return p | return p | ||