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 153,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.
Ready for useThis module is rated asready for general use. It has reached a mature form and is thought to be relatively bug-free and ready for use wherever appropriate. It is ready to mention on help pages and other Wikipedia resources as an option for new users to learn. To reduce server load and bad output, it should be improved bysandbox testing rather than repeated trial-and-error editing.
ProtectedThis module issubject to page protection. It is ahighly visible module in use by a very large number of pages, or issubstituted very frequently. Because vandalism or mistakes would affect many pages, and even trivial editing might cause substantial load on the servers, it isprotected from editing.

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