Module:DPLlua/doc
This is the documentation page for Module:DPLlua
| Function list |
|---|
| L 13 — split L 33 — trim L 37 — mergeItem L 57 — escape L 69 — unEscape L 73 — fixCurlyBrackets L 79 — removeFormattingSettings L 116 — formatInclude L 156 — formatDpl L 249 — toTable L 360 — dpl.ask |
Uses Template:DPLlua helper to make it possible to include all parameters of a template while maintaining good performance.
This module is a helper module to be used by other modules; it may not be designed to be invoked directly. See RuneScape:Lua/Helper modules for a full list and more information.
| Function | Type | Use |
|---|---|---|
ask( ... ) | tables | ask takes a series of tables each containing the settings for a DPL query; it will return the same number of result tables as input tables. All formatting settings are stripped from the config. If the config does not contain include, the result will be a simple list of page names.
{
<pagename#1>,
<pagename#2>,
<pagename#3>,
}
A query with an {
['include'] = {
['template#1'] = {
[1] = val#1,
[2] = val#2,
['param1'] = val#3,
['param2'] = val#4,
},
['template#2'] = {
[3] = val#5,
['param1'] = val#6,
},
['%0'] = val#7
},
['title'] = <pagename>
}
You can also do If a template appears multiple times on the same page then that page will appear multiple times in the returned list where each appearance corresponds with an different occurrence of the template on that page. This behaviour can be changes by adding If the config value If the DPL throws an error it will be available in the Differences with normal DPL:
notcategory = val#1 notcategory = val#2Note, if you include a whole template (e.g. include = '{some template}'), content inside strip markers (not nowiki) can't be cleaned up inside lua so pipe characters (|) will be replaced with § characters and the { and } characters are replaced by ❴ (U+2774) and ❵ (U+2775). Use include = '{some template}, {some template}:1:2:3' instead for the problem parameters. |
Example:
local dpl = require( 'Module:DPLlua' )
local a, b = dpl.ask( {
namespace = 'Module',
linksto = 'Module:Chart data',
distinct = 'strict',
ordermethod = 'title',
nottitlematch = '%/doc|%sandbox%|Exchange/%|Exchange historical/%|Chart data',
ignorecase = true
},{
namespace = '',
ignorecase = 'true',
uses = 'Template:Infobox Recipe',
count = 1,
include = '{Infobox Recipe}, {Infobox Item}'
} )
mw.logObject( a )
mw.logObject( b )
--[=[
table#1 {
"Module:Chart data/test chart",
"Module:Chart data/xp chart",
"Module:Drop rate calculator",
"Module:Enum",
"Module:LibraryUtil",
"Module:Paramtest",
"Module:Rgba",
["DPL time"] = 0.0206,
["Parse time"] = 0.0002,
}
table#1 {
table#2 {
["include"] = table#3 {
["Infobox Item"] = table#4 {
["destroy"] = "Drop",
["disassembly"] = "N/A",
["equipable"] = "No",
["examine"] = "A decorated rune mace.",
["id"] = "46698",
["image"] = "[[File:Rune burial mace.png]]",
["kept"] = "reclaimable",
["members"] = "No",
["name"] = "Rune burial mace",
["quest"] = "No",
["release"] = "[[7 January]] [[2019]]",
["stackable"] = "No",
["tradeable"] = "No",
["update"] = "Mining and Smithing Rework",
["value"] = "1",
["weight"] = "0.04",
},
["Infobox Recipe"] = table#5 {
["geValue"] = "no",
["level"] = "50",
["mat1"] = "Rune mace + 3",
["mat1price"] = "gemw",
["mat1qty"] = "1",
["members"] = "No",
["misc1"] = "You must use a [[burial Anvil]] or [[burial Forge|Forge]]",
["name"] = "Rune burial mace",
["skill"] = "smithing",
["skillXP"] = "960.0",
["ticks"] = "varies",
["ticksnote"] = "See [[Smithing#Forging_items|smithing page]] for details.",
},
},
["title"] = "Rune burial mace",
},
["DPL time"] = 0.0206,
["Parse time"] = 0.00059,
}
]=]