Module:UserLinks: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
Content added Content deleted
m (caps fix)
(add support for a demo parameter)
Line 1: Line 1:
local ToolbarBuilder = require('Module:Toolbar')
local ToolbarBuilder = require('Module:Toolbar')
local u = {} -- Table for user-data helper strings.
local u = {} -- Table for user-data helper strings.
local demo


-- Define a custom error message for this module.
-- Define a custom error message for this module.
local function err(msg, cat)
local function err(msg, cat)
cat = (cat and ('[[Category:' .. cat .. ']]')) or ''
if cat and not demo then
cat = '[[Category:' .. cat .. ']]'
else
cat = ''
end
return '<span class="error">[[Module:UserLinks]] error: ' .. msg .. '.</span>' .. cat
return '<span class="error">[[Module:UserLinks]] error: ' .. msg .. '.</span>' .. cat
end
end
Line 225: Line 230:
end
end
end
end

demo = args.demo -- Set the demo variable.
-- If the username is absent or blank, return an error and a tracking category.
-- If the username is absent or blank, return an error and a tracking category.
if args.user == '' or (not args.user and (not args.User or args.User == '')) then
if args.user == '' or (not args.user and (not args.User or args.User == '')) then