Jump to content

Module:Ustring

Permanently protected module
From Wikipedia, the free encyclopedia

require('strict')returnsetmetatable({},{__index=function(t,k)localwhat=mw.ustring[k]iftype(what)~="function"thenreturnwhatendreturnfunction(frame)localfargs=frame.argslocalfargsused={tag=true}localargs={}localstr_i=1whilefargs['s'..str_i]dofargsused['s'..str_i]=trueargs[str_i]=fargs['s'..str_i]str_i=str_i+1endfori,vinipairs(fargs)dofargsused[i]=trueargs[i+str_i-1]=tonumber(v)orv:gsub("^\\","",1)endifnotfargs.tagthenreturn(what(unpack(args)))-- Outside parens truncate to first result avoiding tail callendlocaltagargs={}forx,yinpairs(fargs)doifnotfargsused[x]thentagargs[x]=yendendreturnframe:extensionTag{name=fargs.tag,content=what(unpack(args)),args=tagargs}endend})
close