Module:DPLlua/doc
This is the documentation page for Module:DPLlua
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 designed to be invoked directly. See Brighter Shores: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 contains 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 the config value The output contains a If the DPL throws an error it will be available in the Differences with normal DPL:
|notcategory = val#1 |notcategory = val#2Note of warning, if you include content containing § symbols the result may be unreliable. 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 = '',
linksto = 'Miner',
distinct = 'strict',
ordermethod = 'title',
count = 5,
ignorecase = true
},{
namespace = '',
uses = 'Template:Reflist',
count = 1,
include = '{Reflist},{Infobox Item}',
ignorecase = true
} )
mw.logObject(a)
mw.logObject(b)
--[=[
table#1 {
"(beginner)",
"(easy)",
"(elite)",
"(g)",
"(hard)",
["time"] = 0.0541,
}
table#1 {
table#2 {
["include"] = table#3 {
["Infobox Item"] = table#4 {
["image"] = "[[File:Basic Bacon.png]]",
["name"] = "Basic Bacon",
},
["Reflist"] = table#5 {
["1"] = "2"
},
},
["title"] = "Basic Bacon",
},
["time"] = 0.0541,
}
]=]