Module:Item util: Difference between revisions

From Path of Exile Wiki
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(format)
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

Module documentation[view] [edit] [history] [purge]


This is a meta module.

This module is meant to be used only by other modules. It should not be invoked in wikitext.

Lua logo

This module depends on the following other modules:

This meta module provides utility functions for modules that deal with items.

Usage

This module should be loaded with require().

-------------------------------------------------------------------------------
-- 
--                              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