Module:Sandbox: Difference between revisions
Jump to navigation
Jump to search
>OmegaK2 No edit summary |
>OmegaK2 No edit summary |
||
Line 2: | Line 2: | ||
-- Imports | -- Imports | ||
-- ---------------------------------------------------------------------------- | -- ---------------------------------------------------------------------------- | ||
local | |||
local m_cargo = mw.ext.cargo | |||
local getArgs = require('Module:Arguments').getArgs | |||
local m_util = require('Module:Util') | local m_util = require('Module:Util') | ||
local p = {} | local p = {} | ||
-- ---------------------------------------------------------------------------- | -- ---------------------------------------------------------------------------- | ||
-- Strings | -- Strings | ||
-- ---------------------------------------------------------------------------- | -- ---------------------------------------------------------------------------- | ||
local i18n = { | local i18n = { | ||
arg = { | |||
monster_resistance_table = 'monster_resistances', | |||
id = 'id', | |||
fire = 'fire', | |||
cold = 'cold', | |||
lightning = 'lightning', | |||
chaos = 'chaos', | |||
}, | }, | ||
} | } | ||
-- ---------------------------------------------------------------------------- | |||
-- Page views | |||
-- ---------------------------------------------------------------------------- | |||
-- | -- | ||
-- Template: | -- Template:Monster Resistance | ||
-- | -- | ||
local monster_resistances = { | |||
id = { | |||
field = i18n.arg.id, | |||
type = 'String', | |||
}, | |||
} | |||
function p. | function p.monster_resistance_table (frame) | ||
local tpl_args = getArgs(frame, { | local tpl_args = getArgs(frame, { | ||
parentFirst = true | parentFirst = true | ||
}) | }) | ||
frame = m_util.misc.get_frame(frame) | frame = m_util.misc.get_frame(frame) | ||
local args = {} | |||
args._table = i18n.arg.monster_resistance_table | |||
for k, data in pairs(monster_resistances) do | |||
args[data.field] = data.type | |||
for k, | |||
end | end | ||
frame:callParserFunction('#cargo_declare:', args) | |||
end | |||
function p.monster_resistance (frame) | |||
local tpl_args = getArgs(frame, { | |||
parentFirst = true | |||
}) | |||
frame = m_util.misc.get_frame(frame) | |||
end | end | ||
return p | return p |
Revision as of 12:36, 27 October 2017
This page is not an actual Scribunto module. It exists to provide editors a place to create experimental modules.
Naming your modules
To keep things tidy, please use the following format to name your experimental modules:
Module:Sandbox/Your username/Module name
Cleaning up unused modules
Experimental modules may be deleted by admins upon request or after a long period of inactivity.
List of modules in this area
For a list of the experimental modules under Module:Sandbox, see Special:PrefixIndex/Module:Sandbox/.
The above documentation is transcluded from Module:Sandbox/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.
-- ----------------------------------------------------------------------------
-- Imports
-- ----------------------------------------------------------------------------
local m_cargo = mw.ext.cargo
local getArgs = require('Module:Arguments').getArgs
local m_util = require('Module:Util')
local p = {}
-- ----------------------------------------------------------------------------
-- Strings
-- ----------------------------------------------------------------------------
local i18n = {
arg = {
monster_resistance_table = 'monster_resistances',
id = 'id',
fire = 'fire',
cold = 'cold',
lightning = 'lightning',
chaos = 'chaos',
},
}
-- ----------------------------------------------------------------------------
-- Page views
-- ----------------------------------------------------------------------------
--
-- Template:Monster Resistance
--
local monster_resistances = {
id = {
field = i18n.arg.id,
type = 'String',
},
}
function p.monster_resistance_table (frame)
local tpl_args = getArgs(frame, {
parentFirst = true
})
frame = m_util.misc.get_frame(frame)
local args = {}
args._table = i18n.arg.monster_resistance_table
for k, data in pairs(monster_resistances) do
args[data.field] = data.type
end
frame:callParserFunction('#cargo_declare:', args)
end
function p.monster_resistance (frame)
local tpl_args = getArgs(frame, {
parentFirst = true
})
frame = m_util.misc.get_frame(frame)
end
return p