Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Module:Data

Permanently protected module
From Wikipedia, the free encyclopedia
Module documentation[view] [edit] [history] [purge]
WarningThis Lua module is used onapproximately 156,000 pages.
To avoid major disruption and server load, any changes should be tested in the module's/sandbox or/testcases subpages, or in your ownmodule sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on thetalk page before implementing them.
Thismodule is rated asready for general use. It has reached a mature state, is considered relatively stable and bug-free, and may be used wherever appropriate. It can be mentioned onhelp pages and other Wikipedia resources as an option for new users. To minimise server load and avoid disruptive output, improvements should be developed throughsandbox testing rather than repeated trial-and-error editing.
Page template-protectedThis module is currentlyprotected from editing.
See theprotection policy andprotection log for more details. Please discuss any changes on thetalk page; you maysubmit an edit request to ask anadministrator to make an edit if it isuncontroversial or supported byconsensus. You may alsorequest that this page be unprotected.

This module allows wikitext to read values from data modules.

Usage

{{#invoke:Data|Module:ModuleName|key1|key2|key3|...}}

Read data valuekey1.key2.key3 fromModule:ModuleName.

The abovedocumentation istranscluded fromModule:Data/doc.(edit |history)
Editors can experiment in this module'ssandbox(edit |diff) and testcases(create) pages.
Subpages of this module.

localmt={}functionmt.__index(t,k)returnfunction(frame)localdata=mw.loadData(k)locali=1for_,vinipairs(frame.args)dolocalty=type(data)ifty~='table'thenlocalargs={}forj=1,i-1doargs[j]=frame.args[j]endifframe.args.softfailthenreturn'<span class="error">[[Category:Pages with failed Module:Data lookups]]Error: Tried to read index "'..mw.text.nowiki(v)..'" of mw.loadData("'..mw.text.nowiki(k)..'").'..mw.text.nowiki(table.concat(args,'.'))..', which is a '..ty..'</span>'elseerror('Tried to read index "'..v..'" of mw.loadData("'..k..'").'..table.concat(args,'.')..', which is a '..ty)endenddata=data[v]i=i+1endreturndataendendreturnsetmetatable({},mt)
Retrieved from "https://en.wikipedia.org/w/index.php?title=Module:Data&oldid=1000791756"
Categories:
Hidden category:

[8]ページ先頭

©2009-2025 Movatter.jp