Actions

Module

Editing Message box

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 5: Line 5:
 
require('Module:No globals')
 
require('Module:No globals')
 
local getArgs
 
local getArgs
 +
local categoryHandler = require('Module:Category handler')._main
 
local yesno = require('Module:Yesno')
 
local yesno = require('Module:Yesno')
  
Line 108: Line 109:
 
obj.categories = {}
 
obj.categories = {}
 
obj.classes = {}
 
obj.classes = {}
-- For lazy loading of [[Module:Category handler]].
 
obj.hasCategories = false
 
  
 
return setmetatable(obj, MessageBox)
 
return setmetatable(obj, MessageBox)
Line 123: Line 122:
 
cat = string.format('[[Category:%s]]', cat)
 
cat = string.format('[[Category:%s]]', cat)
 
end
 
end
self.hasCategories = true
 
 
self.categories[ns] = self.categories[ns] or {}
 
self.categories[ns] = self.categories[ns] or {}
 
table.insert(self.categories[ns], cat)
 
table.insert(self.categories[ns], cat)
Line 431: Line 429:
  
 
function MessageBox:renderCategories()
 
function MessageBox:renderCategories()
if not self.hasCategories then
 
-- No categories added, no need to pass them to Category handler so,
 
-- if it was invoked, it would return the empty string.
 
-- So we shortcut and return the empty string.
 
return ""
 
end
 
 
-- Convert category tables to strings and pass them through
 
-- Convert category tables to strings and pass them through
 
-- [[Module:Category handler]].
 
-- [[Module:Category handler]].
return require('Module:Category handler')._main{
+
return categoryHandler{
 
main = table.concat(self.categories[0] or {}),
 
main = table.concat(self.categories[0] or {}),
 
template = table.concat(self.categories[10] or {}),
 
template = table.concat(self.categories[10] or {}),

Please note that all contributions to Unofficial Stationeers Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Unofficial Stationeers Wiki:Copyrights for details). Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel | Editing help (opens in new window)