Module:Item util: Difference between revisions
Jump to navigation
Jump to search
(Created page with "------------------------------------------------------------------------------- -- -- Module:Item util -- -- This meta module contains utility f...") |
No edit summary |
||
Line 18: | Line 18: | ||
local m = {} | local m = {} | ||
function m.get_item_namespaces( | function m.get_item_namespaces(args) | ||
-- Returns item namespaces from config as a table or as a comma-separated string | -- Returns item namespaces from config as a table or as a comma-separated string | ||
if format == 'list' then | args.format = args.format or 'table' | ||
if args.format == 'list' then | |||
return cfg.item_namespaces_list | return cfg.item_namespaces_list | ||
end | end |
Revision as of 00:21, 7 November 2021
This is a meta module.
This module is meant to be used only by other modules. It should not be invoked in wikitext.
This meta module provides utility functions for modules that deal with items.
Usage
This module should be loaded with require()
.
The above documentation is transcluded from Module:Item util/doc.
Editors can experiment in this module's sandbox and testcases pages.
Subpages of this module.
Editors can experiment in this module's sandbox and testcases pages.
Subpages of this module.
-------------------------------------------------------------------------------
--
-- Module:Item util
--
-- This meta module contains utility functions for modules that deal with items
-------------------------------------------------------------------------------
-- The cfg table contains all localisable strings and configuration, to make it
-- easier to port this module to another wiki.
local cfg = mw.loadData('Module:Item util/config')
local i18n = cfg.i18n
-- ----------------------------------------------------------------------------
-- Exported functions
-- ----------------------------------------------------------------------------
local m = {}
function m.get_item_namespaces(args)
-- Returns item namespaces from config as a table or as a comma-separated string
args.format = args.format or 'table'
if args.format == 'list' then
return cfg.item_namespaces_list
end
return cfg.item_namespaces
end
return m