Module:String2: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
Content added Content deleted
(store just the string)
(allow split to use negative indices)
Line 115: Line 115:
local plain = (args[4] or args.plain or "true"):sub(1,1)
local plain = (args[4] or args.plain or "true"):sub(1,1)
plain = (plain ~= "f" and plain ~= "n" and plain ~= "0")
plain = (plain ~= "f" and plain ~= "n" and plain ~= "0")
return mw.text.split( txt, sep, plain )[idx]
local splittbl = mw.text.split( txt, sep, plain )
if idx < 0 then idx = #splittbl + idx + 1 end
return splittbl[idx]
end
end