匿名
未登录
中文(中国大陆)
登录
Limbo Wiki
搜索
查看“模块:Pwd”的源代码
来自Limbo Wiki
命名空间
模块
讨论
更多
更多
页面操作
阅读
查看源代码
历史
←
模块:Pwd
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
-- Author: User:Staf_Irity local function NonNull(value,def) if(type(value) == "nil") then return def end; return value; end local function Str2List(str) local t ={} for s in string.gmatch(str,"([^%s]+)") do table.insert(t, s) end return t end local Data = mw.loadData('Module:pwd/Data'); local p = {} function p.setTable(frame) -- 出bug自己负责,请提供正确的表。 Data = mw.loadData(frame.args[1]) end function p.setJson(frame) -- 出bug自己负责,请提供正确的Json。 Data = mw.text.jsonDecode(frame.args[1]) end --[[@Deprecated function p.setJsonTemplate(frame) {See id#38864}]]-- function p.get(frame) -- 如何获取单个密码盘 if ((type(frame.args[1]) == "nil") or (type(frame.args[2]) == "nil")) then return 'Error: Not Enough Arguments.'; --第一个是名字,第二个是默认的指向 end t = Data[frame.args[1]]; if (type(t) == 'nil') then return 'Error: Table Not Found.' end -- Start -- class = frame.args["class"]; if (type(class) == 'nil') then class='' end if (type(frame.args[DisablePWD]) == 'nil') then class= 'lw-treediv '.. class end class = 'lw-pwd ' ..class style = frame.args["style"]; if (type(style) == 'nil') then style='' end pwd = mw.html.create('span') :attr('class',class) :attr('style',style) :attr('data-mode',frame.args[1]); for i,v in ipairs(t) do if not(i==1) then pwd:tag('br') end for i2,v2 in ipairs(v) do button = pwd:tag('span') :attr('class','lw-treebut') :attr('role','button') id = frame.args[tostring(i)..'-'..tostring(i2)] if (type(id) == 'nil') then id = frame.args[2] end button:attr('id',id):wikitext(v2); end end mw.log(tostring(pwd)); return tostring(pwd); end --[[ p.get{args={'Number','a',['4-2']='b'}} 含义:数字密码盘,默认为a,第四行第二个为b p.get{args={'Number','a',['4-2']='b',['class']='b',['style']='display:none;'}} 含义:数字密码盘,默认为a,第四行第二个为b,<带有b这一class,默认隐藏>(即当id=b的treebutton被点击后才显示) 禁用treediv(适用于不需要隐藏的密码盘):DisablePWD='' ]]-- function p.getMulti(frame) -- getMulti(string Type,int Levels,<string startClass>,[string]List) if ((type(frame.args[1]) == "nil") or (type(frame.args[2]) == "nil")) then return 'Error: Not Enough Arguments.'; end local t = Data[frame.args[1]]; if (type(t) == 'nil') then return 'Error: Table Not Found.' end -- get max long local l = -1; -- max length local g = 0; -- groups for i,v in ipairs(t) do local n = 0; for i2,v2 in ipairs(v) do n = n + 1; end l = math.max(l,n); g = g + 1; end mw.log(l); mw.log(g); end function p.test(frame) local l = tonumber(frame.args[1]); local g = table.getn(frame.args) - 1; local num = 0; for i,v in ipairs(frame.args) do if not(i == 1) then num = num + tonumber(v)*(l^(g - i + 1)); end mw.log(tonumber(v)) end mw.log(num); end return p
本页使用的模板:
模板:Pwd.css
(
查看源代码
)
模板:TreeButton
(
查看源代码
)
模块:Pwd
(
查看源代码
)
模块:Pwd/Data
(
查看源代码
)
模块:Pwd/doc
(
查看源代码
)
返回
模块:Pwd
。
导航
导航
首页
最近更改
随机页面
操作申请
帮助
入门指南
编辑指南
写作指南
随机
官方
碎数研
谜题保管所
Wiki工具
Wiki工具
特殊页面
页面工具
页面工具
用户页面工具
更多
链入页面
相关更改
页面信息
页面日志