Title: Module:TNT - freem URL Source: https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT Markdown Content: [](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#) - [x] * [Home](https://freemwiki.com/wiki/Main_Page) * [Random](https://freemwiki.com/wiki/Special:Random) * [Log in](https://freemwiki.com/index.php?title=Special:UserLogin&returnto=Module%3ATNT&returntoquery=mobileaction%3Dtoggle_view_mobile%26oldid%3D579598) * [Settings](https://freemwiki.com/index.php?title=Special:MobileOptions&returnto=Module%3ATNT) * [About](https://freemwiki.com/wiki/About) * [Terms of Service](https://freemwiki.com/wiki/Terms_of_Service) [freem](https://freemwiki.com/wiki/Main_Page) Search # Module:TNT * [Language](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT "Language") * [Watch](https://freemwiki.com/index.php?title=Special:UserLogin&returnto=Module%3ATNT) * [Edit](https://freemwiki.com/index.php?title=Module:TNT&action=edit) Revision as of 06:18, 21 October 2025 by [Lukegao](https://freemwiki.com/index.php?title=User:Lukegao&action=edit&redlink=1 "User:Lukegao (page does not exist)")([talk](https://freemwiki.com/index.php?title=User_talk:Lukegao&action=edit&redlink=1 "User talk:Lukegao (page does not exist)") | [contribs](https://freemwiki.com/wiki/Special:Contributions/Lukegao "Special:Contributions/Lukegao"))(1 revision imported) ([diff](https://freemwiki.com/index.php?title=Module:TNT&diff=prev&oldid=579598 "Module:TNT")) [← Older revision](https://freemwiki.com/index.php?title=Module:TNT&direction=prev&oldid=579598 "Module:TNT") | Latest revision (diff) | Newer revision → (diff) _Documentation for this module may be created at [Module:TNT/doc](https://freemwiki.com/index.php?title=Module:TNT/doc&action=edit&redlink=1 "Module:TNT/doc (page does not exist)")_ [](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-1)--[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-2)-- INTRO: (!!! DO NOT RENAME THIS PAGE !!!)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-3)-- This module allows any template or module to be copy/pasted between[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-4)-- wikis without any translation changes. All translation text is stored[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-5)-- in the global Data:*.tab pages on Commons, and used everywhere.[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-6)--[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-7)-- SEE: https://www.mediawiki.org/wiki/Multilingual_Templates_and_Modules[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-8)--[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-9)-- ATTENTION:[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-10)-- Please do NOT rename this module - it has to be identical on all wikis.[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-11)-- This code is maintained at https://www.mediawiki.org/wiki/Module:TNT[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-12)-- Please do not modify it anywhere else, as it may get copied and override your changes.[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-13)-- Suggestions can be made at https://www.mediawiki.org/wiki/Module_talk:TNT[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-14)--[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-15)-- DESCRIPTION:[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-16)-- The "msg" function uses a Commons dataset to translate a message[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-17)-- with a given key (e.g. source-table), plus optional arguments[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-18)-- to the wiki markup in the current content language.[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-19)-- Use lang=xx to set language. Example:[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-20)--[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-21)-- {{#invoke:TNT | msg[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-22)-- | I18n/Template:Graphs.tab [](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-23)-- | source-table [](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-24)-- | param1 }} [](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-25)--[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-26)--[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-27)-- The "doc" function will generate the parameter documentation for templates.[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-28)-- This way all template parameters can be stored and localized in a single Commons dataset.[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-29)-- NOTE: "doc" assumes that all documentation is located in Data:Templatedata/* on Commons.[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-30)--[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-31)-- {{#invoke:TNT | doc | Graph:Lines }}[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-32)-- uses https://commons.wikimedia.org/wiki/Data:Templatedata/Graph:Lines.tab[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-33)-- if the current page is Template:Graph:Lines/doc[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-34)--[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-35)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-36)local p = {}[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-37)local i18nDataset = 'I18n/Module:TNT.tab'[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-38)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-39)-- Forward declaration of the local functions[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-40)local sanitizeDataset, loadData, link, formatMessage[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-41)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-42)function p.msg(frame)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-43)local dataset, id[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-44)local params = {}[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-45)local lang = nil[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-46)for k, v in pairs(frame.args) do[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-47)if k == 1 then[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-48)dataset = mw.text.trim(v)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-49)elseif k == 2 then[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-50)id = mw.text.trim(v)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-51)elseif type(k) == 'number' then[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-52)table.insert(params, mw.text.trim(v))[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-53)elseif k == 'lang' and v ~= '_' then[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-54)lang = mw.text.trim(v)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-55)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-56)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-57)return formatMessage(dataset, id, params, lang)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-58)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-59)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-60)-- Identical to p.msg() above, but used from other lua modules[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-61)-- Parameters: name of dataset, message key, optional arguments[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-62)-- Example with 2 params: format('I18n/Module:TNT', 'error_bad_msgkey', 'my-key', 'my-dataset')[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-63)function p.format(dataset, key, ...)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-64)local checkType = require('libraryUtil').checkType[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-65)checkType('format', 1, dataset, 'string')[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-66)checkType('format', 2, key, 'string')[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-67)return formatMessage(dataset, key, {...})[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-68)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-69)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-70)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-71)-- Identical to p.msg() above, but used from other lua modules with the language param[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-72)-- Parameters: language code, name of dataset, message key, optional arguments[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-73)-- Example with 2 params: formatInLanguage('es', I18n/Module:TNT', 'error_bad_msgkey', 'my-key', 'my-dataset')[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-74)function p.formatInLanguage(lang, dataset, key, ...)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-75)local checkType = require('libraryUtil').checkType[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-76)checkType('formatInLanguage', 1, lang, 'string')[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-77)checkType('formatInLanguage', 2, dataset, 'string')[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-78)checkType('formatInLanguage', 3, key, 'string')[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-79)return formatMessage(dataset, key, {...}, lang)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-80)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-81)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-82)-- Obsolete function that adds a 'c:' prefix to the first param.[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-83)-- "Sandbox/Sample.tab" -> 'c:Data:Sandbox/Sample.tab'[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-84)function p.link(frame)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-85)return link(frame.args[1])[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-86)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-87)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-88)function p.doc(frame)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-89)local dataset = 'Templatedata/' .. sanitizeDataset(frame.args[1])[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-90)return frame:extensionTag('templatedata', p.getTemplateData(dataset)) ..[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-91) formatMessage(i18nDataset, 'edit_doc', {link(dataset)})[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-92)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-93)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-94)function p.getTemplateData(dataset)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-95)-- TODO: add '_' parameter once lua starts reindexing properly for "all" languages[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-96)local data = loadData(dataset)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-97)local names = {}[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-98)for _, field in pairs(data.schema.fields) do[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-99)table.insert(names, field.name)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-100)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-101)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-102)local params = {}[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-103)local paramOrder = {}[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-104)for _, row in pairs(data.data) do[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-105)local newVal = {}[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-106)local name = nil[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-107)for pos, val in pairs(row) do[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-108)local columnName = names[pos][](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-109)if columnName == 'name' then[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-110)name = val[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-111)else[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-112)newVal[columnName] = val[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-113)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-114)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-115)if name then[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-116)params[name] = newVal[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-117)table.insert(paramOrder, name)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-118)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-119)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-120)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-121)-- Work around json encoding treating {"1":{...}} as an [{...}][](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-122)params['zzz123']=''[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-123)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-124)local json = mw.text.jsonEncode({[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-125)params=params,[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-126)paramOrder=paramOrder,[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-127)description=data.description[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-128)})[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-129)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-130)json = string.gsub(json,'"zzz123":"",?', "")[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-131)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-132)return json[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-133)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-134)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-135)-- Local functions[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-136)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-137)sanitizeDataset = function(dataset)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-138)if not dataset then[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-139)return nil[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-140)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-141)dataset = mw.text.trim(dataset)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-142)if dataset == '' then[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-143)return nil[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-144)elseif string.sub(dataset,-4) ~= '.tab' then[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-145)return dataset .. '.tab'[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-146)else[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-147)return dataset[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-148)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-149)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-150)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-151)loadData = function(dataset, lang)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-152)dataset = sanitizeDataset(dataset)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-153)if not dataset then[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-154)error(formatMessage(i18nDataset, 'error_no_dataset', {}))[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-155)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-156)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-157)-- Give helpful error to thirdparties who try and copy this module.[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-158)if not mw.ext or not mw.ext.data or not mw.ext.data.get then[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-159)error('Missing JsonConfig extension; Cannot load https://commons.wikimedia.org/wiki/Data:' .. dataset)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-160)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-161)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-162)local data = mw.ext.data.get(dataset, lang)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-163)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-164)if data == false then[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-165)if dataset == i18nDataset then[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-166)-- Prevent cyclical calls[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-167)error('Missing Commons dataset ' .. i18nDataset)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-168)else[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-169)error(formatMessage(i18nDataset, 'error_bad_dataset', {link(dataset)}))[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-170)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-171)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-172)return data[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-173)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-174)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-175)-- Given a dataset name, convert it to a title with the 'commons:data:' prefix[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-176)link = function(dataset)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-177)return 'c:Data:' .. mw.text.trim(dataset or '')[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-178)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-179)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-180)formatMessage = function(dataset, key, params, lang)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-181)for _, row in pairs(loadData(dataset, lang).data) do[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-182)local id, msg = unpack(row)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-183)if id == key then[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-184)local result = mw.message.newRawMessage(msg, unpack(params or {}))[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-185)return result:plain()[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-186)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-187)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-188)if dataset == i18nDataset then[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-189)-- Prevent cyclical calls[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-190)error('Invalid message key "' .. key .. '"')[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-191)else[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-192)error(formatMessage(i18nDataset, 'error_bad_msgkey', {key, link(dataset)}))[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-193)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-194)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-195)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&oldid=579598&title=Module%3ATNT#L-196)return p Retrieved from "[https://freemwiki.com/index.php?title=Module:TNT&oldid=579598](https://freemwiki.com/index.php?title=Module:TNT&oldid=579598)" [Last edited on 21 October 2025, at 06:18](https://freemwiki.com/index.php?title=Module:TNT&action=history) #### Languages This page is not available in other languages. freem * This page was last edited on 21 October 2025, at 06:18. * Content is available under [Creative Commons Attribution-ShareAlike 4.0](https://creativecommons.org/licenses/by-sa/4.0/) unless otherwise noted. FreemWiki is operated by **FINGERPOWER DIGITAL TECHNOLOGY LLC** (Colorado, Entity ID 20221978727). * [Privacy Policy](https://freemwiki.com/wiki/Privacy_Policy) * [About](https://freemwiki.com/wiki/About) * [Terms of Service](https://freemwiki.com/wiki/Terms_of_Service) * [Desktop](https://freemwiki.com/index.php?title=Module:TNT&mobileaction=toggle_view_desktop&oldid=579598)