Difference between revisions of "Module:String"
Jump to navigation
Jump to search
m
make sub match current behaviour of {{str sub}}
>IAlex m (adding "sub" method) |
>IAlex m (make sub match current behaviour of {{str sub}}) |
||
Line 11: | Line 11: | ||
local arg3 = tonumber( frame.args[3] ) | local arg3 = tonumber( frame.args[3] ) | ||
if arg2 and arg3 then | if arg2 and arg3 then | ||
return string.sub( arg1, | local first = arg2 + 1 | ||
local last = first + arg3 | |||
return string.sub( arg1, first, last ) | |||
else | else | ||
return "" | return "" |