Module:DPLlua/doc

From RuneRealm Wiki
Jump to navigation Jump to search

This is the documentation page for Module:DPLlua

This is a documentation subpage for Module:DPLlua.
It contains usage information, categories, and other content that is not part of the original module page.
Module:DPLlua requires Module:Paramtest.
Module:DPLlua requires libraryUtil.
Module:DPLlua is required by Module:DependencyList.
Module:DPLlua is required by Module:PageListTools.

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 RuneScape:Lua/Helper modules for a full list and more information.

FunctionTypeUse
ask( ... )tablesask 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 of the form include = '{template#1}:1:2:param1:param2, {template#2}:3:param1, %0' will give a result like

{
	['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 include = '{some template}' which will include all parameters of that template in their unexpanded form (templates are not expanded but some content in parser tags is placed in strip markers).

If the config value count is larger than 500 it will automatically generate multiple DPL queries with offsets and their outputs will be combined in the returned result.

The output contains a time field so you don't need to use %DPLTIME%.

If the DPL throws an error it will be available in the error field of the output.

Differences with normal DPL:

  • All formatting options are ignored
  • Surrogate templates (e.g. include = '{template|other template}' are ignored
  • Using include = '{template}' will include all the arguments of that template instead of expanding the template
  • The parameter count can go higher than 500
  • When the value of a parameter is a table it will be expanded into multiple lines. E.g. doing notcategory = {val#1, val#2} will expand into
|notcategory = val#1
|notcategory = val#2
Note 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 = 'Treasure trails',
		distinct = 'strict',
		ordermethod = 'title',
		count = 5,
		ignorecase = true
	},{
		namespace = '',
		uses = 'Template:Recipe',
		count = 1,
		include = '{Recipe},{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 {
        ["destroy"] = "Drop",
        ["equipable"] = "No",
        ["examine"] = "It's a bar of 'perfect' gold.",
        ["id"] = "2365",
        ["image"] = "[[File:'perfect' gold bar.png]]",
        ["members"] = "Yes",
        ["name"] = "'perfect' gold bar",
        ["noteable"] = "No",
        ["placeholder"] = "Yes",
        ["quest"] = "[[Family Crest]]",
        ["release"] = "[[9 April]] [[2002]]",
        ["stackable"] = "No",
        ["tradeable"] = "No",
        ["update"] = "New members quest online!",
        ["value"] = "300",
        ["weight"] = "1.814",
      },
      ["Recipe"] = table#5 {
        ["facilities"] = "Furnace",
        ["mat1"] = "'perfect' gold ore",
        ["mat1cost"] = "No",
        ["members"] = "Yes",
        ["notes"] = "Partial completion of [[Family Crest]]",
        ["outputcost"] = "No",
        ["outputname"] = "'perfect' gold bar",
        ["skill1"] = "Smithing",
        ["skill1exp"] = "22.5",
        ["skill1lvl"] = "40",
        ["ticks"] = "4",
      },
    },
    ["title"] = "'perfect' gold bar",
  },
  ["time"] = 0.0541,
}
]=]