Module:Navbar/sandbox: Difference between revisions

Content deleted Content added
Jackmcbarn (talk | contribs)
Created page with 'local p = {} local HtmlBuilder = require('Module:HtmlBuilder') function trim(s) return mw.ustring.match( s, "^%s*(.-)%s*$" ) end function error(s) loc...'
 
Jackmcbarn (talk | contribs)
use local functions and don't clobber the real error function
Line 3:
local HtmlBuilder = require('Module:HtmlBuilder')
 
local function trim(s)
return mw.ustring.match( s, "^%s*(.-)%s*$" )
end
 
local function errorhtmlError(s)
local span = HtmlBuilder.create('span')
 
Line 19:
end
 
local function getTitle( pageName )
pageName = trim( pageName );
local page_title, talk_page_title;
Line 38:
end
 
local function _navbar( args )
if not args[1] then
return errorhtmlError('No name provided')
end
Line 46:
good, title, talk_title = pcall( getTitle, args[1] );
if not good then
return errorhtmlError(title);
end
 
if not title then
return errorhtmlError('Page does not exist')
end