Difference between revisions of "Module:String"
Jump to navigation
Jump to search
Reverting until it can be figured out why this update broke Template:Strlen and Template:git
>Technical 13 (as copied directly from en:Module:String) |
>Technical 13 (Reverting until it can be figured out why this update broke Template:Strlen and Template:git) |
||
Line 1: | Line 1: | ||
local p = {} | |||
function p.length( frame ) | |||
local arg1 = frame.args[1] | |||
return string.len( arg1 ) | |||
end | |||
function p.sub( frame ) | |||
local arg1 = frame.args[1] | |||
local arg2 = tonumber( frame.args[2] ) | |||
local arg3 = tonumber( frame.args[3] ) | |||
if arg2 and arg3 then | |||
local first = arg2 + 1 | |||
local last = arg2 + arg3 | |||
return string.sub( arg1, first, last ) | |||
else | |||
return "" | |||
local | |||
local | |||
local | |||
if | |||
return | |||
return | |||
end | end | ||
end | |||
end | |||
--[[ | --[[ | ||
Line 100: | Line 23: | ||
to maintain these older templates. | to maintain these older templates. | ||
]] | ]] | ||
function | function p.sublength( frame ) | ||
local i = tonumber( frame.args.i ) or 0 | local i = tonumber( frame.args.i ) or 0 | ||
local len = tonumber( frame.args.len ) | local len = tonumber( frame.args.len ) | ||
Line 106: | Line 29: | ||
end | end | ||
return p | |||