Jump to content

Module:Repeat symbols

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Erik Zachte (talk | contribs) at 20:26, 16 September 2014. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
local p = {}
 
function p.repeat_arg_2_3_from_arg_1 ( frame )
    num_1 = tonumber (frame.args[1]) ;
    str_1 = frame.args[2] ;
    str_2 = frame.args[3] ;

	assert(type(num_1) == "number", "repeat_arg_2_3_from_arg_1 expects a number for first argument") ;
    assert (num_1 >   0, "repeat_arg_2_3_from_arg_1 expects a number > 0 as first argument") ;
    assert (num_1 < 100, "repeat_arg_2_3_from_arg_1 expects a number < 100 as first argument") ;

    num_1 = math.floor (num_1) ;
    mod10 = num_1 % 10 ;
    div10 = math.floor (num_1/10) ; 
  --  return num_1 .. ' type: ' .. type(num_1)
    return num_1 .. ' = ' .. div10 .. ' * 10 + ' .. mod10 .. ' -><br>' .. string.rep(str_1,div10) .. ' - ' .. string.rep(str_2,mod10) ;
    
end
 
return p