Module:LCCN: Difference between revisions

Content deleted Content added
another optimization
optimization
Line 7:
 
local function pad(padlen, ...)
local padsrc
if 1 > select('#', ...) then
return ("0"):rep(padlen)
Line 20 ⟶ 19:
 
local function padleft(str, ...)
local tgtlen = ...
if 1 > select('#', ...) then
return str
end
return pad(tgtlentonumber(...) - mw.ustring.len(str), select(2, ...)) .. str
end
 
local function padright(str, ...)
local tgtlen = ...
if 1 > select('#', ...) then
return str
end
return str .. pad(tgtlentonumber(...) - mw.ustring.len(str), select(2, ...))
end