模組:沙盒/Lopullinen
外观
测试区
- 脚本错误:函数“score”不存在。
- 脚本错误:函数“level”不存在。
- 脚本错误:函数“score”不存在。
- 脚本错误:函数“score”不存在。
脚本错误:函数“ranking”不存在。
备忘录
-- 获取页面信息
mw.title.getCurrentTitle().text -- 獲取頁面標題,不含命名空間
-- 调用Mediawiki模板
mw.getCurrentFrame():expandTemplate{ title = "template", args = { "arg1", "arg2", name = "arg3" } } -- {{template|args1|args2|name=args3}}
mw.getCurrentFrame():callParserFunction{ name = "#tag", args = { "nowiki", "some text" } } -- {{#tag:nowiki|some text}}
-- 字符串处理
_, _, capture1, capture2 = mw.ustring.find(source_text, "(.+)blah blah(.+)") -- 分組捕獲
new_string = mw.ustring.gsub(old_string, ptn, replacement) -- 替换
local p = {}
local getArgs = require('Module:Arguments').getArgs
local function makeInvokeFunc(funcName)
return function (frame)
local args = getArgs(frame)
return p[funcName](args)
end
end
p.main = makeInvokeFunc('_main')
function p._main(args)
return
end
local Row = {}
Row.__index = Row
function Row:__init()
local self = {}
setmetatable(self, Row)
-- 初始化
return self
end
return p