Site Notice

hello, world

Module:UserFunctions

From Project-EPB Commons
Revision as of 17:00, 3 March 2020 by 机智的小鱼君 (talk | contribs) (Created page with "local p = {} local getArgs = require('Module:Arguments').getArgs function p.main(frame) local args = getArgs(frame) local type = args[1] or args['type'] -- 识别功能...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

https://common.epb.wiki/index.php?title=Module:UserFunctions/doc&action=edit


Lua error at line 17: attempt to index field 'create' (a nil value).

Lua error at line 23: attempt to index field 'create' (a nil value).



local p = {}
local getArgs = require('Module:Arguments').getArgs

function p.main(frame)
  local args = getArgs(frame)
  local type = args[1] or args['type']
  -- 识别功能
  if type == 'username' then
    p.username()
  elseif type == 'usergroup' then
    p.usergroup(frame)
  end
end

-- 用户名
function p.username()
  local html = mw.create.html()
  local resHtml = html:tag('span'):addClass('UserFunctions'):attr('data-type', 'username'):wikitext('加载中'):done()
  return tostring(resHtml)
end

function p.usergroup()
  local html = mw.create.html()
  local resHtml = html:tag('span'):addClass('UserFunctions'):attr('data-type', 'usergroup'):wikitext('加载中'):done()
  return tostring(resHtml)
end

return p