CINXE.COM

维基百科:Lua - 维基百科,自由的百科全书

<!DOCTYPE html> <html class="client-nojs vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-sticky-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-enabled skin-theme-clientpref-day vector-toc-available" lang="zh" dir="ltr"> <head> <meta charset="UTF-8"> <title>维基百科:Lua - 维基百科,自由的百科全书</title> <script>(function(){var className="client-js vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-sticky-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-enabled skin-theme-clientpref-day vector-toc-available";var cookie=document.cookie.match(/(?:^|; )zhwikimwclientpreferences=([^;]+)/);if(cookie){cookie[1].split('%2C').forEach(function(pref){className=className.replace(new RegExp('(^| )'+pref.replace(/-clientpref-\w+$|[^\w-]+/g,'')+'-clientpref-\\w+( |$)'),'$1'+pref+'$2');});}document.documentElement.className=className;}());RLCONF={"wgBreakFrames":false,"wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""],"wgDefaultDateFormat":"zh", "wgMonthNames":["","1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],"wgRequestId":"985173be-5ab1-4354-be3d-c4c22eec5676","wgCanonicalNamespace":"Project","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":4,"wgPageName":"Wikipedia:Lua","wgTitle":"Lua","wgCurRevisionId":82323831,"wgRevisionId":82323831,"wgArticleId":3807368,"wgIsArticle":true,"wgIsRedirect":false,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":["維基百科資訊頁","Lua模板"],"wgPageViewLanguage":"zh","wgPageContentLanguage":"zh","wgPageContentModel":"wikitext","wgRelevantPageName":"Wikipedia:Lua","wgRelevantArticleId":3807368,"wgUserVariant":"zh","wgIsProbablyEditable":true,"wgRelevantPageIsProbablyEditable":true,"wgRestrictionEdit":[],"wgRestrictionMove":[],"wgNoticeProject":"wikipedia","wgCiteReferencePreviewsActive":true,"wgMediaViewerOnClick":true,"wgMediaViewerEnabledByDefault":true,"wgPopupsFlags":0,"wgVisualEditor":{"pageLanguageCode":"zh", "pageLanguageDir":"ltr","pageVariantFallbacks":["zh-hans","zh-hant","zh-cn","zh-tw","zh-hk","zh-sg","zh-mo","zh-my"]},"wgMFDisplayWikibaseDescriptions":{"search":true,"watchlist":true,"tagline":true,"nearby":true},"wgWMESchemaEditAttemptStepOversample":false,"wgWMEPageLength":10000,"wgRelatedArticlesCompat":[],"wgCentralAuthMobileDomain":false,"wgEditSubmitButtonLabelPublish":true,"wgDiscussionToolsFeaturesEnabled":{"replytool":true,"newtopictool":true,"sourcemodetoolbar":true,"topicsubscription":false,"autotopicsub":false,"visualenhancements":false,"visualenhancements_reply":false,"visualenhancements_pageframe":false},"wgDiscussionToolsFallbackEditMode":"source","wgULSPosition":"interlanguage","wgULSisCompactLinksEnabled":false,"wgVector2022LanguageInHeader":true,"wgULSisLanguageSelectorEmpty":false,"wgWikibaseItemId":"Q6811431","wgCheckUserClientHintsHeadersJsApi":["brands","architecture","bitness","fullVersionList","mobile","model","platform","platformVersion"], "GEHomepageSuggestedEditsEnableTopics":true,"wgGETopicsMatchModeEnabled":false,"wgGEStructuredTaskRejectionReasonTextInputEnabled":false,"wgGELevelingUpEnabledForUser":false};RLSTATE={"ext.gadget.large-font":"ready","ext.gadget.OldAfD":"ready","ext.globalCssJs.user.styles":"ready","site.styles":"ready","user.styles":"ready","ext.globalCssJs.user":"ready","user":"ready","user.options":"loading","ext.cite.styles":"ready","ext.pygments":"ready","ext.discussionTools.init.styles":"ready","oojs-ui-core.styles":"ready","oojs-ui.styles.indicators":"ready","mediawiki.widgets.styles":"ready","oojs-ui-core.icons":"ready","skins.vector.search.codex.styles":"ready","skins.vector.styles":"ready","skins.vector.icons":"ready","ext.wikimediamessages.styles":"ready","ext.visualEditor.desktopArticleTarget.noscript":"ready","ext.uls.interlanguage":"ready","wikibase.client.init":"ready","ext.wikimediaBadges":"ready"};RLPAGEMODULES=["ext.cite.ux-enhancements","ext.pygments.view","site", "mediawiki.page.ready","mediawiki.toc","skins.vector.js","ext.centralNotice.geoIP","ext.centralNotice.startUp","ext.gadget.edit0","ext.gadget.WikiMiniAtlas","ext.gadget.UnihanTooltips","ext.gadget.Difflink","ext.gadget.pseudonamespace-UI","ext.gadget.SpecialWikitext","ext.gadget.switcher","ext.gadget.VariantAlly","ext.gadget.AdvancedSiteNotices","ext.gadget.hideConversionTab","ext.gadget.internalLinkHelper-altcolor","ext.gadget.noteTA","ext.gadget.NavFrame","ext.gadget.collapsibleTables","ext.gadget.scrollUpButton","ext.urlShortener.toolbar","ext.centralauth.centralautologin","mmv.bootstrap","ext.popups","ext.visualEditor.desktopArticleTarget.init","ext.visualEditor.targetLoader","ext.echo.centralauth","ext.discussionTools.init","ext.eventLogging","ext.wikimediaEvents","ext.navigationTiming","ext.uls.interface","ext.cx.eventlogging.campaigns","wikibase.client.vector-2022","ext.checkUser.clientHints","wikibase.sidebar.tracking"];</script> <script>(RLQ=window.RLQ||[]).push(function(){mw.loader.impl(function(){return["user.options@12s5i",function($,jQuery,require,module){mw.user.tokens.set({"patrolToken":"+\\","watchToken":"+\\","csrfToken":"+\\"}); }];});});</script> <link rel="stylesheet" href="/w/load.php?lang=zh&amp;modules=ext.cite.styles%7Cext.discussionTools.init.styles%7Cext.pygments%2CwikimediaBadges%7Cext.uls.interlanguage%7Cext.visualEditor.desktopArticleTarget.noscript%7Cext.wikimediamessages.styles%7Cmediawiki.widgets.styles%7Coojs-ui-core.icons%2Cstyles%7Coojs-ui.styles.indicators%7Cskins.vector.icons%2Cstyles%7Cskins.vector.search.codex.styles%7Cwikibase.client.init&amp;only=styles&amp;skin=vector-2022"> <script async="" src="/w/load.php?lang=zh&amp;modules=startup&amp;only=scripts&amp;raw=1&amp;skin=vector-2022"></script> <meta name="ResourceLoaderDynamicStyles" content=""> <link rel="stylesheet" href="/w/load.php?lang=zh&amp;modules=ext.gadget.OldAfD%2Clarge-font&amp;only=styles&amp;skin=vector-2022"> <link rel="stylesheet" href="/w/load.php?lang=zh&amp;modules=site.styles&amp;only=styles&amp;skin=vector-2022"> <meta name="generator" content="MediaWiki 1.44.0-wmf.4"> <meta name="referrer" content="origin"> <meta name="referrer" content="origin-when-cross-origin"> <meta name="robots" content="max-image-preview:standard"> <meta name="format-detection" content="telephone=no"> <meta name="viewport" content="width=1120"> <meta property="og:title" content="维基百科:Lua - 维基百科,自由的百科全书"> <meta property="og:type" content="website"> <link rel="preconnect" href="//upload.wikimedia.org"> <link rel="alternate" media="only screen and (max-width: 640px)" href="//zh.m.wikipedia.org/wiki/Wikipedia:Lua"> <link rel="alternate" type="application/x-wiki" title="编辑本页" href="/w/index.php?title=Wikipedia:Lua&amp;action=edit"> <link rel="apple-touch-icon" href="/static/apple-touch/wikipedia.png"> <link rel="icon" href="/static/favicon/wikipedia.ico"> <link rel="search" type="application/opensearchdescription+xml" href="/w/rest.php/v1/search" title="Wikipedia (zh)"> <link rel="EditURI" type="application/rsd+xml" href="//zh.wikipedia.org/w/api.php?action=rsd"> <link rel="canonical" href="https://zh.wikipedia.org/wiki/Wikipedia:Lua"> <link rel="alternate" hreflang="zh" href="https://zh.wikipedia.org/wiki/Wikipedia:Lua"> <link rel="alternate" hreflang="zh-Hans" href="https://zh.wikipedia.org/zh-hans/Wikipedia:Lua"> <link rel="alternate" hreflang="zh-Hans-CN" href="https://zh.wikipedia.org/zh-cn/Wikipedia:Lua"> <link rel="alternate" hreflang="zh-Hans-MY" href="https://zh.wikipedia.org/zh-my/Wikipedia:Lua"> <link rel="alternate" hreflang="zh-Hans-SG" href="https://zh.wikipedia.org/zh-sg/Wikipedia:Lua"> <link rel="alternate" hreflang="zh-Hant" href="https://zh.wikipedia.org/zh-hant/Wikipedia:Lua"> <link rel="alternate" hreflang="zh-Hant-HK" href="https://zh.wikipedia.org/zh-hk/Wikipedia:Lua"> <link rel="alternate" hreflang="zh-Hant-MO" href="https://zh.wikipedia.org/zh-mo/Wikipedia:Lua"> <link rel="alternate" hreflang="zh-Hant-TW" href="https://zh.wikipedia.org/zh-tw/Wikipedia:Lua"> <link rel="alternate" hreflang="x-default" href="https://zh.wikipedia.org/wiki/Wikipedia:Lua"> <link rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/deed.zh"> <link rel="alternate" type="application/atom+xml" title="Wikipedia的Atom feed" href="/w/index.php?title=Special:%E6%9C%80%E8%BF%91%E6%9B%B4%E6%94%B9&amp;feed=atom"> <link rel="dns-prefetch" href="//meta.wikimedia.org" /> <link rel="dns-prefetch" href="//login.wikimedia.org"> </head> <body class="ext-discussiontools-replytool-enabled ext-discussiontools-newtopictool-enabled ext-discussiontools-sourcemodetoolbar-enabled skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-4 ns-subject mw-editable page-Wikipedia_Lua rootpage-Wikipedia_Lua skin-vector-2022 action-view"><a class="mw-jump-link" href="#bodyContent">跳转到内容</a> <div class="vector-header-container"> <header class="vector-header mw-header"> <div class="vector-header-start"> <nav class="vector-main-menu-landmark" aria-label="站点"> <div id="vector-main-menu-dropdown" class="vector-dropdown vector-main-menu-dropdown vector-button-flush-left vector-button-flush-right" > <input type="checkbox" id="vector-main-menu-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-main-menu-dropdown" class="vector-dropdown-checkbox " aria-label="主菜单" > <label id="vector-main-menu-dropdown-label" for="vector-main-menu-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-menu mw-ui-icon-wikimedia-menu"></span> <span class="vector-dropdown-label-text">主菜单</span> </label> <div class="vector-dropdown-content"> <div id="vector-main-menu-unpinned-container" class="vector-unpinned-container"> <div id="vector-main-menu" class="vector-main-menu vector-pinnable-element"> <div class="vector-pinnable-header vector-main-menu-pinnable-header vector-pinnable-header-unpinned" data-feature-name="main-menu-pinned" data-pinnable-element-id="vector-main-menu" data-pinned-container-id="vector-main-menu-pinned-container" data-unpinned-container-id="vector-main-menu-unpinned-container" > <div class="vector-pinnable-header-label">主菜单</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-main-menu.pin">移至侧栏</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-main-menu.unpin">隐藏</button> </div> <div id="p-navigation" class="vector-menu mw-portlet mw-portlet-navigation" > <div class="vector-menu-heading"> 导航 </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-mainpage-description" class="mw-list-item"><a href="/wiki/Wikipedia:%E9%A6%96%E9%A1%B5" title="访问首页[z]" accesskey="z"><span>首页</span></a></li><li id="n-indexpage" class="mw-list-item"><a href="/wiki/Wikipedia:%E5%88%86%E7%B1%BB%E7%B4%A2%E5%BC%95" title="以分类索引搜寻中文维基百科"><span>分类索引</span></a></li><li id="n-Featured_content" class="mw-list-item"><a href="/wiki/Portal:%E7%89%B9%E8%89%B2%E5%85%A7%E5%AE%B9" title="查看中文维基百科的特色内容"><span>特色内容</span></a></li><li id="n-currentevents" class="mw-list-item"><a href="/wiki/Portal:%E6%96%B0%E8%81%9E%E5%8B%95%E6%85%8B" title="提供当前新闻事件的背景资料"><span>新闻动态</span></a></li><li id="n-recentchanges" class="mw-list-item"><a href="/wiki/Special:%E6%9C%80%E8%BF%91%E6%9B%B4%E6%94%B9" title="列出维基百科中的最近修改[r]" accesskey="r"><span>最近更改</span></a></li><li id="n-randompage" class="mw-list-item"><a href="/wiki/Special:%E9%9A%8F%E6%9C%BA%E9%A1%B5%E9%9D%A2" title="随机载入一个页面[x]" accesskey="x"><span>随机条目</span></a></li> </ul> </div> </div> <div id="p-help" class="vector-menu mw-portlet mw-portlet-help" > <div class="vector-menu-heading"> 帮助 </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-help" class="mw-list-item"><a href="/wiki/Help:%E7%9B%AE%E5%BD%95" title="寻求帮助"><span>帮助</span></a></li><li id="n-portal" class="mw-list-item"><a href="/wiki/Wikipedia:%E7%A4%BE%E7%BE%A4%E9%A6%96%E9%A1%B5" title="关于本计划、你可以做什么、应该如何做"><span>维基社群</span></a></li><li id="n-policy" class="mw-list-item"><a href="/wiki/Wikipedia:%E6%96%B9%E9%87%9D%E8%88%87%E6%8C%87%E5%BC%95" title="查看维基百科的方针和指引"><span>方针与指引</span></a></li><li id="n-villagepump" class="mw-list-item"><a href="/wiki/Wikipedia:%E4%BA%92%E5%8A%A9%E5%AE%A2%E6%A0%88" title="参与维基百科社群的讨论"><span>互助客栈</span></a></li><li id="n-Information_desk" class="mw-list-item"><a href="/wiki/Wikipedia:%E7%9F%A5%E8%AF%86%E9%97%AE%E7%AD%94" title="解答任何与维基百科无关的问题的地方"><span>知识问答</span></a></li><li id="n-conversion" class="mw-list-item"><a href="/wiki/Wikipedia:%E5%AD%97%E8%AF%8D%E8%BD%AC%E6%8D%A2" title="提出字词转换请求"><span>字词转换</span></a></li><li id="n-IRC" class="mw-list-item"><a href="/wiki/Wikipedia:IRC%E8%81%8A%E5%A4%A9%E9%A2%91%E9%81%93"><span>IRC即时聊天</span></a></li><li id="n-contact" class="mw-list-item"><a href="/wiki/Wikipedia:%E8%81%94%E7%BB%9C%E6%88%91%E4%BB%AC" title="如何联络维基百科"><span>联络我们</span></a></li><li id="n-about" class="mw-list-item"><a href="/wiki/Wikipedia:%E5%85%B3%E4%BA%8E" title="查看维基百科的简介"><span>关于维基百科</span></a></li> </ul> </div> </div> </div> </div> </div> </div> </nav> <a href="/wiki/Wikipedia:%E9%A6%96%E9%A1%B5" class="mw-logo"> <img class="mw-logo-icon" src="/static/images/icons/wikipedia.png" alt="" aria-hidden="true" height="50" width="50"> <span class="mw-logo-container skin-invert"> <img class="mw-logo-wordmark" alt="维基百科" src="/static/images/mobile/copyright/wikipedia-wordmark-zh.svg" style="width: 6.5625em; height: 1.375em;"> <img class="mw-logo-tagline" alt="自由的百科全书" src="/static/images/mobile/copyright/wikipedia-tagline-zh.svg" width="103" height="14" style="width: 6.4375em; height: 0.875em;"> </span> </a> </div> <div class="vector-header-end"> <div id="p-search" role="search" class="vector-search-box-vue vector-search-box-collapses vector-search-box-show-thumbnail vector-search-box-auto-expand-width vector-search-box"> <a href="/wiki/Special:%E6%90%9C%E7%B4%A2" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only search-toggle" title="搜索维基百科[f]" accesskey="f"><span class="vector-icon mw-ui-icon-search mw-ui-icon-wikimedia-search"></span> <span>搜索</span> </a> <div class="vector-typeahead-search-container"> <div class="cdx-typeahead-search cdx-typeahead-search--show-thumbnail cdx-typeahead-search--auto-expand-width"> <form action="/w/index.php" id="searchform" class="cdx-search-input cdx-search-input--has-end-button"> <div id="simpleSearch" class="cdx-search-input__input-wrapper" data-search-loc="header-moved"> <div class="cdx-text-input cdx-text-input--has-start-icon"> <input class="cdx-text-input__input" type="search" name="search" placeholder="搜索维基百科" aria-label="搜索维基百科" autocapitalize="sentences" title="搜索维基百科[f]" accesskey="f" id="searchInput" > <span class="cdx-text-input__icon cdx-text-input__start-icon"></span> </div> <input type="hidden" name="title" value="Special:搜索"> </div> <button class="cdx-button cdx-search-input__end-button">搜索</button> </form> </div> </div> </div> <nav class="vector-user-links vector-user-links-wide" aria-label="个人工具"> <div class="vector-user-links-main"> <div id="p-vector-user-menu-preferences" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <div id="p-vector-user-menu-userpage" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <nav class="vector-appearance-landmark" aria-label="外观"> <div id="vector-appearance-dropdown" class="vector-dropdown " title="更改页面字体大小、宽度和颜色的外观" > <input type="checkbox" id="vector-appearance-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-appearance-dropdown" class="vector-dropdown-checkbox " aria-label="外观" > <label id="vector-appearance-dropdown-label" for="vector-appearance-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-appearance mw-ui-icon-wikimedia-appearance"></span> <span class="vector-dropdown-label-text">外观</span> </label> <div class="vector-dropdown-content"> <div id="vector-appearance-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <div id="p-vector-user-menu-notifications" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <div id="p-vector-user-menu-overflow" class="vector-menu mw-portlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="https://donate.wikimedia.org/?utm_source=donate&amp;utm_medium=sidebar&amp;utm_campaign=spontaneous&amp;uselang=zh-hans" class=""><span>资助维基百科</span></a> </li> <li id="pt-createaccount-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:%E5%88%9B%E5%BB%BA%E8%B4%A6%E6%88%B7&amp;returnto=Wikipedia%3ALua" title="我们推荐您创建账号并登录,但这不是强制性的" class=""><span>创建账号</span></a> </li> <li id="pt-login-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:%E7%94%A8%E6%88%B7%E7%99%BB%E5%BD%95&amp;returnto=Wikipedia%3ALua" title="建议你登录,尽管并非必须。[o]" accesskey="o" class=""><span>登录</span></a> </li> </ul> </div> </div> </div> <div id="vector-user-links-dropdown" class="vector-dropdown vector-user-menu vector-button-flush-right vector-user-menu-logged-out" title="更多选项" > <input type="checkbox" id="vector-user-links-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-user-links-dropdown" class="vector-dropdown-checkbox " aria-label="个人工具" > <label id="vector-user-links-dropdown-label" for="vector-user-links-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-ellipsis mw-ui-icon-wikimedia-ellipsis"></span> <span class="vector-dropdown-label-text">个人工具</span> </label> <div class="vector-dropdown-content"> <div id="p-personal" class="vector-menu mw-portlet mw-portlet-personal user-links-collapsible-item" title="用户菜单" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport" class="user-links-collapsible-item mw-list-item"><a href="https://donate.wikimedia.org/?utm_source=donate&amp;utm_medium=sidebar&amp;utm_campaign=spontaneous&amp;uselang=zh-hans"><span>资助维基百科</span></a></li><li id="pt-createaccount" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:%E5%88%9B%E5%BB%BA%E8%B4%A6%E6%88%B7&amp;returnto=Wikipedia%3ALua" title="我们推荐您创建账号并登录,但这不是强制性的"><span class="vector-icon mw-ui-icon-userAdd mw-ui-icon-wikimedia-userAdd"></span> <span>创建账号</span></a></li><li id="pt-login" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:%E7%94%A8%E6%88%B7%E7%99%BB%E5%BD%95&amp;returnto=Wikipedia%3ALua" title="建议你登录,尽管并非必须。[o]" accesskey="o"><span class="vector-icon mw-ui-icon-logIn mw-ui-icon-wikimedia-logIn"></span> <span>登录</span></a></li> </ul> </div> </div> <div id="p-user-menu-anon-editor" class="vector-menu mw-portlet mw-portlet-user-menu-anon-editor" > <div class="vector-menu-heading"> 未登录编辑者的页面 <a href="/wiki/Help:%E6%96%B0%E6%89%8B%E5%85%A5%E9%97%A8" aria-label="了解有关编辑的更多信息"><span>了解详情</span></a> </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-anoncontribs" class="mw-list-item"><a href="/wiki/Special:%E6%88%91%E7%9A%84%E8%B4%A1%E7%8C%AE" title="来自此IP地址的编辑列表[y]" accesskey="y"><span>贡献</span></a></li><li id="pt-anontalk" class="mw-list-item"><a href="/wiki/Special:%E6%88%91%E7%9A%84%E8%AE%A8%E8%AE%BA%E9%A1%B5" title="对于来自此IP地址编辑的讨论[n]" accesskey="n"><span>讨论</span></a></li> </ul> </div> </div> </div> </div> </nav> </div> </header> </div> <div class="mw-page-container"> <div class="mw-page-container-inner"> <div class="vector-sitenotice-container"> <div id="siteNotice"><!-- CentralNotice --></div> </div> <div class="vector-column-start"> <div class="vector-main-menu-container"> <div id="mw-navigation"> <nav id="mw-panel" class="vector-main-menu-landmark" aria-label="站点"> <div id="vector-main-menu-pinned-container" class="vector-pinned-container"> </div> </nav> </div> </div> <div class="vector-sticky-pinned-container"> <nav id="mw-panel-toc" aria-label="目录" data-event-name="ui.sidebar-toc" class="mw-table-of-contents-container vector-toc-landmark"> <div id="vector-toc-pinned-container" class="vector-pinned-container"> <div id="vector-toc" class="vector-toc vector-pinnable-element"> <div class="vector-pinnable-header vector-toc-pinnable-header vector-pinnable-header-pinned" data-feature-name="toc-pinned" data-pinnable-element-id="vector-toc" > <h2 class="vector-pinnable-header-label">目录</h2> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-toc.pin">移至侧栏</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-toc.unpin">隐藏</button> </div> <ul class="vector-toc-contents" id="mw-panel-toc-list"> <li id="toc-mw-content-text" class="vector-toc-list-item vector-toc-level-1"> <a href="#" class="vector-toc-link"> <div class="vector-toc-text">序言</div> </a> </li> <li id="toc-用法" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#用法"> <div class="vector-toc-text"> <span class="vector-toc-numb">1</span> <span>用法</span> </div> </a> <button aria-controls="toc-用法-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>开关用法子章节</span> </button> <ul id="toc-用法-sublist" class="vector-toc-list"> <li id="toc-运行模块" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#运行模块"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.1</span> <span>运行模块</span> </div> </a> <ul id="toc-运行模块-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-運用參數" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#運用參數"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.2</span> <span>運用參數</span> </div> </a> <ul id="toc-運用參數-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-關於Lua" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#關於Lua"> <div class="vector-toc-text"> <span class="vector-toc-numb">2</span> <span>關於Lua</span> </div> </a> <ul id="toc-關於Lua-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-單元測試" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#單元測試"> <div class="vector-toc-text"> <span class="vector-toc-numb">3</span> <span>單元測試</span> </div> </a> <ul id="toc-單元測試-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-MediaWiki特有功能" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#MediaWiki特有功能"> <div class="vector-toc-text"> <span class="vector-toc-numb">4</span> <span>MediaWiki特有功能</span> </div> </a> <button aria-controls="toc-MediaWiki特有功能-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>开关MediaWiki特有功能子章节</span> </button> <ul id="toc-MediaWiki特有功能-sublist" class="vector-toc-list"> <li id="toc-Lua輸入值限制" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Lua輸入值限制"> <div class="vector-toc-text"> <span class="vector-toc-numb">4.1</span> <span>Lua輸入值限制</span> </div> </a> <ul id="toc-Lua輸入值限制-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-維基代碼" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#維基代碼"> <div class="vector-toc-text"> <span class="vector-toc-numb">4.2</span> <span>維基代碼</span> </div> </a> <ul id="toc-維基代碼-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-使用Lua的模板" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#使用Lua的模板"> <div class="vector-toc-text"> <span class="vector-toc-numb">5</span> <span>使用Lua的模板</span> </div> </a> <ul id="toc-使用Lua的模板-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-资源" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#资源"> <div class="vector-toc-text"> <span class="vector-toc-numb">6</span> <span>资源</span> </div> </a> <button aria-controls="toc-资源-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>开关资源子章节</span> </button> <ul id="toc-资源-sublist" class="vector-toc-list"> <li id="toc-文档" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#文档"> <div class="vector-toc-text"> <span class="vector-toc-numb">6.1</span> <span>文档</span> </div> </a> <ul id="toc-文档-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-指南" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#指南"> <div class="vector-toc-text"> <span class="vector-toc-numb">6.2</span> <span>指南</span> </div> </a> <ul id="toc-指南-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Lua相关文章" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Lua相关文章"> <div class="vector-toc-text"> <span class="vector-toc-numb">6.3</span> <span>Lua相关文章</span> </div> </a> <ul id="toc-Lua相关文章-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-模块链接列表" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#模块链接列表"> <div class="vector-toc-text"> <span class="vector-toc-numb">6.4</span> <span>模块链接列表</span> </div> </a> <ul id="toc-模块链接列表-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> </ul> </div> </div> </nav> </div> </div> <div class="mw-content-container"> <main id="content" class="mw-body"> <header class="mw-body-header vector-page-titlebar"> <nav aria-label="目录" class="vector-toc-landmark"> <div id="vector-page-titlebar-toc" class="vector-dropdown vector-page-titlebar-toc vector-button-flush-left" > <input type="checkbox" id="vector-page-titlebar-toc-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-titlebar-toc" class="vector-dropdown-checkbox " aria-label="开关目录" > <label id="vector-page-titlebar-toc-label" for="vector-page-titlebar-toc-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-listBullet mw-ui-icon-wikimedia-listBullet"></span> <span class="vector-dropdown-label-text">开关目录</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-titlebar-toc-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <h1 id="firstHeading" class="firstHeading mw-first-heading"><span class="mw-page-title-namespace">维基百科</span><span class="mw-page-title-separator">:</span><span class="mw-page-title-main">Lua</span></h1> <div id="p-lang-btn" class="vector-dropdown mw-portlet mw-portlet-lang" > <input type="checkbox" id="p-lang-btn-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-p-lang-btn" class="vector-dropdown-checkbox mw-interlanguage-selector" aria-label="前往另一种语言写成的文章。65种语言可用" > <label id="p-lang-btn-label" for="p-lang-btn-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--action-progressive mw-portlet-lang-heading-65" aria-hidden="true" ><span class="vector-icon mw-ui-icon-language-progressive mw-ui-icon-wikimedia-language-progressive"></span> <span class="vector-dropdown-label-text">65种语言</span> </label> <div class="vector-dropdown-content"> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li class="interlanguage-link interwiki-af mw-list-item"><a href="https://af.wikipedia.org/wiki/Wikipedia:Lua" title="Wikipedia:Lua – 南非荷兰语" lang="af" hreflang="af" data-title="Wikipedia:Lua" data-language-autonym="Afrikaans" data-language-local-name="南非荷兰语" class="interlanguage-link-target"><span>Afrikaans</span></a></li><li class="interlanguage-link interwiki-ar mw-list-item"><a href="https://ar.wikipedia.org/wiki/%D9%88%D9%8A%D9%83%D9%8A%D8%A8%D9%8A%D8%AF%D9%8A%D8%A7:%D9%84%D9%88%D8%A7" title="ويكيبيديا:لوا – 阿拉伯语" lang="ar" hreflang="ar" data-title="ويكيبيديا:لوا" data-language-autonym="العربية" data-language-local-name="阿拉伯语" class="interlanguage-link-target"><span>العربية</span></a></li><li class="interlanguage-link interwiki-as mw-list-item"><a href="https://as.wikipedia.org/wiki/%E0%A7%B1%E0%A6%BF%E0%A6%95%E0%A6%BF%E0%A6%AA%E0%A6%BF%E0%A6%A1%E0%A6%BF%E0%A6%AF%E0%A6%BC%E0%A6%BE:%E0%A6%B2%E0%A7%81%E0%A7%B1%E0%A6%BE" title="ৱিকিপিডিয়া:লুৱা – 阿萨姆语" lang="as" hreflang="as" data-title="ৱিকিপিডিয়া:লুৱা" data-language-autonym="অসমীয়া" data-language-local-name="阿萨姆语" class="interlanguage-link-target"><span>অসমীয়া</span></a></li><li class="interlanguage-link interwiki-azb mw-list-item"><a href="https://azb.wikipedia.org/wiki/%D9%88%DB%8C%DA%A9%DB%8C%E2%80%8C%D9%BE%D8%AF%DB%8C%D8%A7:%D9%84%D9%88%D8%A2" title="ویکی‌پدیا:لوآ – South Azerbaijani" lang="azb" hreflang="azb" data-title="ویکی‌پدیا:لوآ" data-language-autonym="تۆرکجه" data-language-local-name="South Azerbaijani" class="interlanguage-link-target"><span>تۆرکجه</span></a></li><li class="interlanguage-link interwiki-bcl mw-list-item"><a href="https://bcl.wikipedia.org/wiki/Wikipedia:Lua" title="Wikipedia:Lua – Central Bikol" lang="bcl" hreflang="bcl" data-title="Wikipedia:Lua" data-language-autonym="Bikol Central" data-language-local-name="Central Bikol" class="interlanguage-link-target"><span>Bikol Central</span></a></li><li class="interlanguage-link interwiki-bg mw-list-item"><a href="https://bg.wikipedia.org/wiki/%D0%A3%D0%B8%D0%BA%D0%B8%D0%BF%D0%B5%D0%B4%D0%B8%D1%8F:%D0%9C%D0%BE%D0%B4%D1%83%D0%BB%D0%B8" title="Уикипедия:Модули – 保加利亚语" lang="bg" hreflang="bg" data-title="Уикипедия:Модули" data-language-autonym="Български" data-language-local-name="保加利亚语" class="interlanguage-link-target"><span>Български</span></a></li><li class="interlanguage-link interwiki-bh mw-list-item"><a href="https://bh.wikipedia.org/wiki/%E0%A4%B5%E0%A4%BF%E0%A4%95%E0%A4%BF%E0%A4%AA%E0%A5%80%E0%A4%A1%E0%A4%BF%E0%A4%AF%E0%A4%BE:%E0%A4%B2%E0%A5%81%E0%A4%86" title="विकिपीडिया:लुआ – Bhojpuri" lang="bh" hreflang="bh" data-title="विकिपीडिया:लुआ" data-language-autonym="भोजपुरी" data-language-local-name="Bhojpuri" class="interlanguage-link-target"><span>भोजपुरी</span></a></li><li class="interlanguage-link interwiki-bn mw-list-item"><a href="https://bn.wikipedia.org/wiki/%E0%A6%89%E0%A6%87%E0%A6%95%E0%A6%BF%E0%A6%AA%E0%A6%BF%E0%A6%A1%E0%A6%BF%E0%A6%AF%E0%A6%BC%E0%A6%BE:%E0%A6%B2%E0%A7%81%E0%A6%AF%E0%A6%BC%E0%A6%BE" title="উইকিপিডিয়া:লুয়া – 孟加拉语" lang="bn" hreflang="bn" data-title="উইকিপিডিয়া:লুয়া" data-language-autonym="বাংলা" data-language-local-name="孟加拉语" class="interlanguage-link-target"><span>বাংলা</span></a></li><li class="interlanguage-link interwiki-ca mw-list-item"><a href="https://ca.wikipedia.org/wiki/Viquip%C3%A8dia:Lua" title="Viquipèdia:Lua – 加泰罗尼亚语" lang="ca" hreflang="ca" data-title="Viquipèdia:Lua" data-language-autonym="Català" data-language-local-name="加泰罗尼亚语" class="interlanguage-link-target"><span>Català</span></a></li><li class="interlanguage-link interwiki-ckb mw-list-item"><a href="https://ckb.wikipedia.org/wiki/%D9%88%DB%8C%DA%A9%DB%8C%D9%BE%DB%8C%D8%AF%DB%8C%D8%A7:%D9%84%D9%88%D8%A7" title="ویکیپیدیا:لوا – 中库尔德语" lang="ckb" hreflang="ckb" data-title="ویکیپیدیا:لوا" data-language-autonym="کوردی" data-language-local-name="中库尔德语" class="interlanguage-link-target"><span>کوردی</span></a></li><li class="interlanguage-link interwiki-cs mw-list-item"><a href="https://cs.wikipedia.org/wiki/N%C3%A1pov%C4%9Bda:Moduly" title="Nápověda:Moduly – 捷克语" lang="cs" hreflang="cs" data-title="Nápověda:Moduly" data-language-autonym="Čeština" data-language-local-name="捷克语" class="interlanguage-link-target"><span>Čeština</span></a></li><li class="interlanguage-link interwiki-da mw-list-item"><a href="https://da.wikipedia.org/wiki/Wikipedia:Lua" title="Wikipedia:Lua – 丹麦语" lang="da" hreflang="da" data-title="Wikipedia:Lua" data-language-autonym="Dansk" data-language-local-name="丹麦语" class="interlanguage-link-target"><span>Dansk</span></a></li><li class="interlanguage-link interwiki-de mw-list-item"><a href="https://de.wikipedia.org/wiki/Hilfe:Lua" title="Hilfe:Lua – 德语" lang="de" hreflang="de" data-title="Hilfe:Lua" data-language-autonym="Deutsch" data-language-local-name="德语" class="interlanguage-link-target"><span>Deutsch</span></a></li><li class="interlanguage-link interwiki-dsb mw-list-item"><a href="https://dsb.wikipedia.org/wiki/Wikipedija:Lua" title="Wikipedija:Lua – 下索布语" lang="dsb" hreflang="dsb" data-title="Wikipedija:Lua" data-language-autonym="Dolnoserbski" data-language-local-name="下索布语" class="interlanguage-link-target"><span>Dolnoserbski</span></a></li><li class="interlanguage-link interwiki-en mw-list-item"><a href="https://en.wikipedia.org/wiki/Wikipedia:Lua" title="Wikipedia:Lua – 英语" lang="en" hreflang="en" data-title="Wikipedia:Lua" data-language-autonym="English" data-language-local-name="英语" class="interlanguage-link-target"><span>English</span></a></li><li class="interlanguage-link interwiki-eo mw-list-item"><a href="https://eo.wikipedia.org/wiki/Vikipedio:Lua" title="Vikipedio:Lua – 世界语" lang="eo" hreflang="eo" data-title="Vikipedio:Lua" data-language-autonym="Esperanto" data-language-local-name="世界语" class="interlanguage-link-target"><span>Esperanto</span></a></li><li class="interlanguage-link interwiki-es mw-list-item"><a href="https://es.wikipedia.org/wiki/Wikipedia:Lua" title="Wikipedia:Lua – 西班牙语" lang="es" hreflang="es" data-title="Wikipedia:Lua" data-language-autonym="Español" data-language-local-name="西班牙语" class="interlanguage-link-target"><span>Español</span></a></li><li class="interlanguage-link interwiki-fa mw-list-item"><a href="https://fa.wikipedia.org/wiki/%D9%88%DB%8C%DA%A9%DB%8C%E2%80%8C%D9%BE%D8%AF%DB%8C%D8%A7:%D9%84%D9%88%D8%A2" title="ویکی‌پدیا:لوآ – 波斯语" lang="fa" hreflang="fa" data-title="ویکی‌پدیا:لوآ" data-language-autonym="فارسی" data-language-local-name="波斯语" class="interlanguage-link-target"><span>فارسی</span></a></li><li class="interlanguage-link interwiki-fi mw-list-item"><a href="https://fi.wikipedia.org/wiki/Ohje:Lua" title="Ohje:Lua – 芬兰语" lang="fi" hreflang="fi" data-title="Ohje:Lua" data-language-autonym="Suomi" data-language-local-name="芬兰语" class="interlanguage-link-target"><span>Suomi</span></a></li><li class="interlanguage-link interwiki-fr mw-list-item"><a href="https://fr.wikipedia.org/wiki/Wikip%C3%A9dia:Lua" title="Wikipédia:Lua – 法语" lang="fr" hreflang="fr" data-title="Wikipédia:Lua" data-language-autonym="Français" data-language-local-name="法语" class="interlanguage-link-target"><span>Français</span></a></li><li class="interlanguage-link interwiki-gl mw-list-item"><a href="https://gl.wikipedia.org/wiki/Wikipedia:M%C3%B3dulos" title="Wikipedia:Módulos – 加利西亚语" lang="gl" hreflang="gl" data-title="Wikipedia:Módulos" data-language-autonym="Galego" data-language-local-name="加利西亚语" class="interlanguage-link-target"><span>Galego</span></a></li><li class="interlanguage-link interwiki-gu mw-list-item"><a href="https://gu.wikipedia.org/wiki/%E0%AA%B5%E0%AA%BF%E0%AA%95%E0%AA%BF%E0%AA%AA%E0%AB%80%E0%AA%A1%E0%AA%BF%E0%AA%AF%E0%AA%BE:Lua" title="વિકિપીડિયા:Lua – 古吉拉特语" lang="gu" hreflang="gu" data-title="વિકિપીડિયા:Lua" data-language-autonym="ગુજરાતી" data-language-local-name="古吉拉特语" class="interlanguage-link-target"><span>ગુજરાતી</span></a></li><li class="interlanguage-link interwiki-he mw-list-item"><a href="https://he.wikipedia.org/wiki/%D7%95%D7%99%D7%A7%D7%99%D7%A4%D7%93%D7%99%D7%94:%D7%9C%D7%95%D7%90%D7%94" title="ויקיפדיה:לואה – 希伯来语" lang="he" hreflang="he" data-title="ויקיפדיה:לואה" data-language-autonym="עברית" data-language-local-name="希伯来语" class="interlanguage-link-target"><span>עברית</span></a></li><li class="interlanguage-link interwiki-hr mw-list-item"><a href="https://hr.wikipedia.org/wiki/Wikipedija:Lua" title="Wikipedija:Lua – 克罗地亚语" lang="hr" hreflang="hr" data-title="Wikipedija:Lua" data-language-autonym="Hrvatski" data-language-local-name="克罗地亚语" class="interlanguage-link-target"><span>Hrvatski</span></a></li><li class="interlanguage-link interwiki-hsb mw-list-item"><a href="https://hsb.wikipedia.org/wiki/Wikipedija:Lua" title="Wikipedija:Lua – 上索布语" lang="hsb" hreflang="hsb" data-title="Wikipedija:Lua" data-language-autonym="Hornjoserbsce" data-language-local-name="上索布语" class="interlanguage-link-target"><span>Hornjoserbsce</span></a></li><li class="interlanguage-link interwiki-hu mw-list-item"><a href="https://hu.wikipedia.org/wiki/Wikip%C3%A9dia:Lua" title="Wikipédia:Lua – 匈牙利语" lang="hu" hreflang="hu" data-title="Wikipédia:Lua" data-language-autonym="Magyar" data-language-local-name="匈牙利语" class="interlanguage-link-target"><span>Magyar</span></a></li><li class="interlanguage-link interwiki-ia mw-list-item"><a href="https://ia.wikipedia.org/wiki/Wikipedia:Modulo" title="Wikipedia:Modulo – 国际语" lang="ia" hreflang="ia" data-title="Wikipedia:Modulo" data-language-autonym="Interlingua" data-language-local-name="国际语" class="interlanguage-link-target"><span>Interlingua</span></a></li><li class="interlanguage-link interwiki-id mw-list-item"><a href="https://id.wikipedia.org/wiki/Wikipedia:Lua" title="Wikipedia:Lua – 印度尼西亚语" lang="id" hreflang="id" data-title="Wikipedia:Lua" data-language-autonym="Bahasa Indonesia" data-language-local-name="印度尼西亚语" class="interlanguage-link-target"><span>Bahasa Indonesia</span></a></li><li class="interlanguage-link interwiki-ilo mw-list-item"><a href="https://ilo.wikipedia.org/wiki/Wikipedia:Lua" title="Wikipedia:Lua – 伊洛卡诺语" lang="ilo" hreflang="ilo" data-title="Wikipedia:Lua" data-language-autonym="Ilokano" data-language-local-name="伊洛卡诺语" class="interlanguage-link-target"><span>Ilokano</span></a></li><li class="interlanguage-link interwiki-it mw-list-item"><a href="https://it.wikipedia.org/wiki/Aiuto:Moduli" title="Aiuto:Moduli – 意大利语" lang="it" hreflang="it" data-title="Aiuto:Moduli" data-language-autonym="Italiano" data-language-local-name="意大利语" class="interlanguage-link-target"><span>Italiano</span></a></li><li class="interlanguage-link interwiki-ja mw-list-item"><a href="https://ja.wikipedia.org/wiki/Wikipedia:Lua" title="Wikipedia:Lua – 日语" lang="ja" hreflang="ja" data-title="Wikipedia:Lua" data-language-autonym="日本語" data-language-local-name="日语" class="interlanguage-link-target"><span>日本語</span></a></li><li class="interlanguage-link interwiki-ko mw-list-item"><a href="https://ko.wikipedia.org/wiki/%EC%9C%84%ED%82%A4%EB%B0%B1%EA%B3%BC:%EB%A3%A8%EC%95%84" title="위키백과:루아 – 韩语" lang="ko" hreflang="ko" data-title="위키백과:루아" data-language-autonym="한국어" data-language-local-name="韩语" class="interlanguage-link-target"><span>한국어</span></a></li><li class="interlanguage-link interwiki-ku mw-list-item"><a href="https://ku.wikipedia.org/wiki/W%C3%AEk%C3%AEpediya:Lua" title="Wîkîpediya:Lua – 库尔德语" lang="ku" hreflang="ku" data-title="Wîkîpediya:Lua" data-language-autonym="Kurdî" data-language-local-name="库尔德语" class="interlanguage-link-target"><span>Kurdî</span></a></li><li class="interlanguage-link interwiki-la mw-list-item"><a href="https://la.wikipedia.org/wiki/Vicipaedia:Lua" title="Vicipaedia:Lua – 拉丁语" lang="la" hreflang="la" data-title="Vicipaedia:Lua" data-language-autonym="Latina" data-language-local-name="拉丁语" class="interlanguage-link-target"><span>Latina</span></a></li><li class="interlanguage-link interwiki-lt mw-list-item"><a href="https://lt.wikipedia.org/wiki/Vikipedija:Lua" title="Vikipedija:Lua – 立陶宛语" lang="lt" hreflang="lt" data-title="Vikipedija:Lua" data-language-autonym="Lietuvių" data-language-local-name="立陶宛语" class="interlanguage-link-target"><span>Lietuvių</span></a></li><li class="interlanguage-link interwiki-lv mw-list-item"><a href="https://lv.wikipedia.org/wiki/Vikip%C4%93dija:Lua" title="Vikipēdija:Lua – 拉脱维亚语" lang="lv" hreflang="lv" data-title="Vikipēdija:Lua" data-language-autonym="Latviešu" data-language-local-name="拉脱维亚语" class="interlanguage-link-target"><span>Latviešu</span></a></li><li class="interlanguage-link interwiki-mr mw-list-item"><a href="https://mr.wikipedia.org/wiki/%E0%A4%B5%E0%A4%BF%E0%A4%95%E0%A4%BF%E0%A4%AA%E0%A5%80%E0%A4%A1%E0%A4%BF%E0%A4%AF%E0%A4%BE:%E0%A4%B2%E0%A5%81%E0%A4%86" title="विकिपीडिया:लुआ – 马拉地语" lang="mr" hreflang="mr" data-title="विकिपीडिया:लुआ" data-language-autonym="मराठी" data-language-local-name="马拉地语" class="interlanguage-link-target"><span>मराठी</span></a></li><li class="interlanguage-link interwiki-ms mw-list-item"><a href="https://ms.wikipedia.org/wiki/Wikipedia:Lua" title="Wikipedia:Lua – 马来语" lang="ms" hreflang="ms" data-title="Wikipedia:Lua" data-language-autonym="Bahasa Melayu" data-language-local-name="马来语" class="interlanguage-link-target"><span>Bahasa Melayu</span></a></li><li class="interlanguage-link interwiki-my mw-list-item"><a href="https://my.wikipedia.org/wiki/%E1%80%9D%E1%80%AE%E1%80%80%E1%80%AE%E1%80%95%E1%80%AE%E1%80%B8%E1%80%92%E1%80%AE%E1%80%B8%E1%80%9A%E1%80%AC%E1%80%B8:Lua" title="ဝီကီပီးဒီးယား:Lua – 缅甸语" lang="my" hreflang="my" data-title="ဝီကီပီးဒီးယား:Lua" data-language-autonym="မြန်မာဘာသာ" data-language-local-name="缅甸语" class="interlanguage-link-target"><span>မြန်မာဘာသာ</span></a></li><li class="interlanguage-link interwiki-nn mw-list-item"><a href="https://nn.wikipedia.org/wiki/Wikipedia:Lua" title="Wikipedia:Lua – 挪威尼诺斯克语" lang="nn" hreflang="nn" data-title="Wikipedia:Lua" data-language-autonym="Norsk nynorsk" data-language-local-name="挪威尼诺斯克语" class="interlanguage-link-target"><span>Norsk nynorsk</span></a></li><li class="interlanguage-link interwiki-no mw-list-item"><a href="https://no.wikipedia.org/wiki/Wikipedia:Lua" title="Wikipedia:Lua – 书面挪威语" lang="nb" hreflang="nb" data-title="Wikipedia:Lua" data-language-autonym="Norsk bokmål" data-language-local-name="书面挪威语" class="interlanguage-link-target"><span>Norsk bokmål</span></a></li><li class="interlanguage-link interwiki-or mw-list-item"><a href="https://or.wikipedia.org/wiki/%E0%AC%89%E0%AC%87%E0%AC%95%E0%AC%BF%E0%AC%AA%E0%AC%BF%E0%AC%A1%E0%AC%BC%E0%AC%BF%E0%AC%86:%E0%AC%B2%E0%AD%81%E0%AC%86" title="ଉଇକିପିଡ଼ିଆ:ଲୁଆ – 奥里亚语" lang="or" hreflang="or" data-title="ଉଇକିପିଡ଼ିଆ:ଲୁଆ" data-language-autonym="ଓଡ଼ିଆ" data-language-local-name="奥里亚语" class="interlanguage-link-target"><span>ଓଡ଼ିଆ</span></a></li><li class="interlanguage-link interwiki-pa mw-list-item"><a href="https://pa.wikipedia.org/wiki/%E0%A8%B5%E0%A8%BF%E0%A8%95%E0%A9%80%E0%A8%AA%E0%A9%80%E0%A8%A1%E0%A9%80%E0%A8%86:%E0%A8%B8%E0%A8%95%E0%A8%B0%E0%A8%BF%E0%A8%AC%E0%A9%81%E0%A9%B0%E0%A8%9F%E0%A9%8B" title="ਵਿਕੀਪੀਡੀਆ:ਸਕਰਿਬੁੰਟੋ – 旁遮普语" lang="pa" hreflang="pa" data-title="ਵਿਕੀਪੀਡੀਆ:ਸਕਰਿਬੁੰਟੋ" data-language-autonym="ਪੰਜਾਬੀ" data-language-local-name="旁遮普语" class="interlanguage-link-target"><span>ਪੰਜਾਬੀ</span></a></li><li class="interlanguage-link interwiki-pl mw-list-item"><a href="https://pl.wikipedia.org/wiki/Wikipedia:Lua" title="Wikipedia:Lua – 波兰语" lang="pl" hreflang="pl" data-title="Wikipedia:Lua" data-language-autonym="Polski" data-language-local-name="波兰语" class="interlanguage-link-target"><span>Polski</span></a></li><li class="interlanguage-link interwiki-ps mw-list-item"><a href="https://ps.wikipedia.org/wiki/%D9%88%D9%8A%DA%A9%D9%8A%D9%BE%DB%90%DA%89%D9%8A%D8%A7:%D9%84%D9%88%D8%A7" title="ويکيپېډيا:لوا – 普什图语" lang="ps" hreflang="ps" data-title="ويکيپېډيا:لوا" data-language-autonym="پښتو" data-language-local-name="普什图语" class="interlanguage-link-target"><span>پښتو</span></a></li><li class="interlanguage-link interwiki-pt mw-list-item"><a href="https://pt.wikipedia.org/wiki/Wikip%C3%A9dia:Lua" title="Wikipédia:Lua – 葡萄牙语" lang="pt" hreflang="pt" data-title="Wikipédia:Lua" data-language-autonym="Português" data-language-local-name="葡萄牙语" class="interlanguage-link-target"><span>Português</span></a></li><li class="interlanguage-link interwiki-ro mw-list-item"><a href="https://ro.wikipedia.org/wiki/Wikipedia:Lua" title="Wikipedia:Lua – 罗马尼亚语" lang="ro" hreflang="ro" data-title="Wikipedia:Lua" data-language-autonym="Română" data-language-local-name="罗马尼亚语" class="interlanguage-link-target"><span>Română</span></a></li><li class="interlanguage-link interwiki-ru mw-list-item"><a href="https://ru.wikipedia.org/wiki/%D0%92%D0%B8%D0%BA%D0%B8%D0%BF%D0%B5%D0%B4%D0%B8%D1%8F:%D0%9C%D0%BE%D0%B4%D1%83%D0%BB%D0%B8" title="Википедия:Модули – 俄语" lang="ru" hreflang="ru" data-title="Википедия:Модули" data-language-autonym="Русский" data-language-local-name="俄语" class="interlanguage-link-target"><span>Русский</span></a></li><li class="interlanguage-link interwiki-sa mw-list-item"><a href="https://sa.wikipedia.org/wiki/%E0%A4%B5%E0%A4%BF%E0%A4%95%E0%A4%BF%E0%A4%AA%E0%A5%80%E0%A4%A1%E0%A4%BF%E0%A4%AF%E0%A4%BE:Lua" title="विकिपीडिया:Lua – 梵语" lang="sa" hreflang="sa" data-title="विकिपीडिया:Lua" data-language-autonym="संस्कृतम्" data-language-local-name="梵语" class="interlanguage-link-target"><span>संस्कृतम्</span></a></li><li class="interlanguage-link interwiki-sd mw-list-item"><a href="https://sd.wikipedia.org/wiki/%D9%88%DA%AA%D9%8A%D9%BE%D9%8A%DA%8A%D9%8A%D8%A7:%D9%84%D9%8F%D9%88%D9%88%D8%A7" title="وڪيپيڊيا:لُووا – 信德语" lang="sd" hreflang="sd" data-title="وڪيپيڊيا:لُووا" data-language-autonym="سنڌي" data-language-local-name="信德语" class="interlanguage-link-target"><span>سنڌي</span></a></li><li class="interlanguage-link interwiki-sh mw-list-item"><a href="https://sh.wikipedia.org/wiki/Wikipedija:Lua" title="Wikipedija:Lua – 塞尔维亚-克罗地亚语" lang="sh" hreflang="sh" data-title="Wikipedija:Lua" data-language-autonym="Srpskohrvatski / српскохрватски" data-language-local-name="塞尔维亚-克罗地亚语" class="interlanguage-link-target"><span>Srpskohrvatski / српскохрватски</span></a></li><li class="interlanguage-link interwiki-si mw-list-item"><a href="https://si.wikipedia.org/wiki/%E0%B7%80%E0%B7%92%E0%B6%9A%E0%B7%92%E0%B6%B4%E0%B7%93%E0%B6%A9%E0%B7%92%E0%B6%BA%E0%B7%8F:%E0%B6%BD%E0%B7%94%E0%B7%80%E0%B7%8F" title="විකිපීඩියා:ලුවා – 僧伽罗语" lang="si" hreflang="si" data-title="විකිපීඩියා:ලුවා" data-language-autonym="සිංහල" data-language-local-name="僧伽罗语" class="interlanguage-link-target"><span>සිංහල</span></a></li><li class="interlanguage-link interwiki-simple mw-list-item"><a href="https://simple.wikipedia.org/wiki/Wikipedia:Lua" title="Wikipedia:Lua – Simple English" lang="en-simple" hreflang="en-simple" data-title="Wikipedia:Lua" data-language-autonym="Simple English" data-language-local-name="Simple English" class="interlanguage-link-target"><span>Simple English</span></a></li><li class="interlanguage-link interwiki-sl mw-list-item"><a href="https://sl.wikipedia.org/wiki/Wikipedija:Lua" title="Wikipedija:Lua – 斯洛文尼亚语" lang="sl" hreflang="sl" data-title="Wikipedija:Lua" data-language-autonym="Slovenščina" data-language-local-name="斯洛文尼亚语" class="interlanguage-link-target"><span>Slovenščina</span></a></li><li class="interlanguage-link interwiki-sr mw-list-item"><a href="https://sr.wikipedia.org/wiki/%D0%92%D0%B8%D0%BA%D0%B8%D0%BF%D0%B5%D0%B4%D0%B8%D1%98%D0%B0:%D0%9B%D1%83%D0%B0" title="Википедија:Луа – 塞尔维亚语" lang="sr" hreflang="sr" data-title="Википедија:Луа" data-language-autonym="Српски / srpski" data-language-local-name="塞尔维亚语" class="interlanguage-link-target"><span>Српски / srpski</span></a></li><li class="interlanguage-link interwiki-su mw-list-item"><a href="https://su.wikipedia.org/wiki/Wikipedia:Lua" title="Wikipedia:Lua – 巽他语" lang="su" hreflang="su" data-title="Wikipedia:Lua" data-language-autonym="Sunda" data-language-local-name="巽他语" class="interlanguage-link-target"><span>Sunda</span></a></li><li class="interlanguage-link interwiki-sv mw-list-item"><a href="https://sv.wikipedia.org/wiki/Wikipedia:Lua" title="Wikipedia:Lua – 瑞典语" lang="sv" hreflang="sv" data-title="Wikipedia:Lua" data-language-autonym="Svenska" data-language-local-name="瑞典语" class="interlanguage-link-target"><span>Svenska</span></a></li><li class="interlanguage-link interwiki-th mw-list-item"><a href="https://th.wikipedia.org/wiki/%E0%B8%A7%E0%B8%B4%E0%B8%81%E0%B8%B4%E0%B8%9E%E0%B8%B5%E0%B9%80%E0%B8%94%E0%B8%B5%E0%B8%A2:%E0%B8%A5%E0%B8%B9%E0%B8%AD%E0%B8%B2" title="วิกิพีเดีย:ลูอา – 泰语" lang="th" hreflang="th" data-title="วิกิพีเดีย:ลูอา" data-language-autonym="ไทย" data-language-local-name="泰语" class="interlanguage-link-target"><span>ไทย</span></a></li><li class="interlanguage-link interwiki-tr mw-list-item"><a href="https://tr.wikipedia.org/wiki/Vikipedi:Lua" title="Vikipedi:Lua – 土耳其语" lang="tr" hreflang="tr" data-title="Vikipedi:Lua" data-language-autonym="Türkçe" data-language-local-name="土耳其语" class="interlanguage-link-target"><span>Türkçe</span></a></li><li class="interlanguage-link interwiki-uk mw-list-item"><a href="https://uk.wikipedia.org/wiki/%D0%92%D1%96%D0%BA%D1%96%D0%BF%D0%B5%D0%B4%D1%96%D1%8F:%D0%9C%D0%BE%D0%B4%D1%83%D0%BB%D1%96" title="Вікіпедія:Модулі – 乌克兰语" lang="uk" hreflang="uk" data-title="Вікіпедія:Модулі" data-language-autonym="Українська" data-language-local-name="乌克兰语" class="interlanguage-link-target"><span>Українська</span></a></li><li class="interlanguage-link interwiki-uz mw-list-item"><a href="https://uz.wikipedia.org/wiki/Vikipediya:Modullar" title="Vikipediya:Modullar – 乌兹别克语" lang="uz" hreflang="uz" data-title="Vikipediya:Modullar" data-language-autonym="Oʻzbekcha / ўзбекча" data-language-local-name="乌兹别克语" class="interlanguage-link-target"><span>Oʻzbekcha / ўзбекча</span></a></li><li class="interlanguage-link interwiki-vi mw-list-item"><a href="https://vi.wikipedia.org/wiki/Wikipedia:Lua" title="Wikipedia:Lua – 越南语" lang="vi" hreflang="vi" data-title="Wikipedia:Lua" data-language-autonym="Tiếng Việt" data-language-local-name="越南语" class="interlanguage-link-target"><span>Tiếng Việt</span></a></li><li class="interlanguage-link interwiki-wuu mw-list-item"><a href="https://wuu.wikipedia.org/wiki/Wikipedia:Lua" title="Wikipedia:Lua – 吴语" lang="wuu" hreflang="wuu" data-title="Wikipedia:Lua" data-language-autonym="吴语" data-language-local-name="吴语" class="interlanguage-link-target"><span>吴语</span></a></li><li class="interlanguage-link interwiki-zh-min-nan mw-list-item"><a href="https://zh-min-nan.wikipedia.org/wiki/Wikipedia:Lua" title="Wikipedia:Lua – 闽南语" lang="nan" hreflang="nan" data-title="Wikipedia:Lua" data-language-autonym="閩南語 / Bân-lâm-gú" data-language-local-name="闽南语" class="interlanguage-link-target"><span>閩南語 / Bân-lâm-gú</span></a></li><li class="interlanguage-link interwiki-zh-yue mw-list-item"><a href="https://zh-yue.wikipedia.org/wiki/Wikipedia:Lua" title="Wikipedia:Lua – 粤语" lang="yue" hreflang="yue" data-title="Wikipedia:Lua" data-language-autonym="粵語" data-language-local-name="粤语" class="interlanguage-link-target"><span>粵語</span></a></li> </ul> <div class="after-portlet after-portlet-lang"><span class="wb-langlinks-edit wb-langlinks-link"><a href="https://www.wikidata.org/wiki/Special:EntityPage/Q6811431#sitelinks-wikipedia" title="编辑跨语言链接" class="wbc-editpage">编辑链接</a></span></div> </div> </div> </div> </header> <div class="vector-page-toolbar"> <div class="vector-page-toolbar-container"> <div id="left-navigation"> <nav aria-label="命名空间"> <div id="p-associated-pages" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-associated-pages" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-nstab-project" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Wikipedia:Lua" title="查看维基计划页面[c]" accesskey="c"><span>项目页面</span></a></li><li id="ca-talk" class="vector-tab-noicon mw-list-item"><a href="/wiki/Wikipedia_talk:Lua" rel="discussion" title="关于此页面的讨论[t]" accesskey="t"><span>讨论</span></a></li> </ul> </div> </div> <div id="vector-variants-dropdown" class="vector-dropdown " > <input type="checkbox" id="vector-variants-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-variants-dropdown" class="vector-dropdown-checkbox " aria-label="更改语言变体" > <label id="vector-variants-dropdown-label" for="vector-variants-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">不转换</span> </label> <div class="vector-dropdown-content"> <div id="p-variants" class="vector-menu mw-portlet mw-portlet-variants" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-varlang-0" class="selected ca-variants-zh mw-list-item"><a href="/zh/Wikipedia:Lua" lang="zh" hreflang="zh"><span>不转换</span></a></li><li id="ca-varlang-1" class="ca-variants-zh-Hans mw-list-item"><a href="/zh-hans/Wikipedia:Lua" lang="zh-Hans" hreflang="zh-Hans"><span>简体</span></a></li><li id="ca-varlang-2" class="ca-variants-zh-Hant mw-list-item"><a href="/zh-hant/Wikipedia:Lua" lang="zh-Hant" hreflang="zh-Hant"><span>繁體</span></a></li><li id="ca-varlang-3" class="ca-variants-zh-Hans-CN mw-list-item"><a href="/zh-cn/Wikipedia:Lua" lang="zh-Hans-CN" hreflang="zh-Hans-CN"><span>大陆简体</span></a></li><li id="ca-varlang-4" class="ca-variants-zh-Hant-HK mw-list-item"><a href="/zh-hk/Wikipedia:Lua" lang="zh-Hant-HK" hreflang="zh-Hant-HK"><span>香港繁體</span></a></li><li id="ca-varlang-5" class="ca-variants-zh-Hant-MO mw-list-item"><a href="/zh-mo/Wikipedia:Lua" lang="zh-Hant-MO" hreflang="zh-Hant-MO"><span>澳門繁體</span></a></li><li id="ca-varlang-6" class="ca-variants-zh-Hans-MY mw-list-item"><a href="/zh-my/Wikipedia:Lua" lang="zh-Hans-MY" hreflang="zh-Hans-MY"><span>大马简体</span></a></li><li id="ca-varlang-7" class="ca-variants-zh-Hans-SG mw-list-item"><a href="/zh-sg/Wikipedia:Lua" lang="zh-Hans-SG" hreflang="zh-Hans-SG"><span>新加坡简体</span></a></li><li id="ca-varlang-8" class="ca-variants-zh-Hant-TW mw-list-item"><a href="/zh-tw/Wikipedia:Lua" lang="zh-Hant-TW" hreflang="zh-Hant-TW"><span>臺灣正體</span></a></li> </ul> </div> </div> </div> </div> </nav> </div> <div id="right-navigation" class="vector-collapsible"> <nav aria-label="查看"> <div id="p-views" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-views" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-view" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Wikipedia:Lua"><span>阅读</span></a></li><li id="ca-edit" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Wikipedia:Lua&amp;action=edit" title="编辑该页面[e]" accesskey="e"><span>编辑</span></a></li><li id="ca-history" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Wikipedia:Lua&amp;action=history" title="本页面的早前版本。[h]" accesskey="h"><span>查看历史</span></a></li> </ul> </div> </div> </nav> <nav class="vector-page-tools-landmark" aria-label="页面工具"> <div id="vector-page-tools-dropdown" class="vector-dropdown vector-page-tools-dropdown" > <input type="checkbox" id="vector-page-tools-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-tools-dropdown" class="vector-dropdown-checkbox " aria-label="工具" > <label id="vector-page-tools-dropdown-label" for="vector-page-tools-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">工具</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-tools-unpinned-container" class="vector-unpinned-container"> <div id="vector-page-tools" class="vector-page-tools vector-pinnable-element"> <div class="vector-pinnable-header vector-page-tools-pinnable-header vector-pinnable-header-unpinned" data-feature-name="page-tools-pinned" data-pinnable-element-id="vector-page-tools" data-pinned-container-id="vector-page-tools-pinned-container" data-unpinned-container-id="vector-page-tools-unpinned-container" > <div class="vector-pinnable-header-label">工具</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-page-tools.pin">移至侧栏</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-page-tools.unpin">隐藏</button> </div> <div id="p-cactions" class="vector-menu mw-portlet mw-portlet-cactions emptyPortlet vector-has-collapsible-items" title="更多选项" > <div class="vector-menu-heading"> 操作 </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-more-view" class="selected vector-more-collapsible-item mw-list-item"><a href="/wiki/Wikipedia:Lua"><span>阅读</span></a></li><li id="ca-more-edit" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Wikipedia:Lua&amp;action=edit" title="编辑该页面[e]" accesskey="e"><span>编辑</span></a></li><li id="ca-more-history" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Wikipedia:Lua&amp;action=history"><span>查看历史</span></a></li> </ul> </div> </div> <div id="p-tb" class="vector-menu mw-portlet mw-portlet-tb" > <div class="vector-menu-heading"> 常规 </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="t-whatlinkshere" class="mw-list-item"><a href="/wiki/Special:%E9%93%BE%E5%85%A5%E9%A1%B5%E9%9D%A2/Wikipedia:Lua" title="列出所有与本页相链的页面[j]" accesskey="j"><span>链入页面</span></a></li><li id="t-recentchangeslinked" class="mw-list-item"><a href="/wiki/Special:%E9%93%BE%E5%87%BA%E6%9B%B4%E6%94%B9/Wikipedia:Lua" rel="nofollow" title="页面链出所有页面的更改[k]" accesskey="k"><span>相关更改</span></a></li><li id="t-upload" class="mw-list-item"><a href="/wiki/Project:%E4%B8%8A%E4%BC%A0" title="上传图像或多媒体文件[u]" accesskey="u"><span>上传文件</span></a></li><li id="t-specialpages" class="mw-list-item"><a href="/wiki/Special:%E7%89%B9%E6%AE%8A%E9%A1%B5%E9%9D%A2" title="全部特殊页面的列表[q]" accesskey="q"><span>特殊页面</span></a></li><li id="t-permalink" class="mw-list-item"><a href="/w/index.php?title=Wikipedia:Lua&amp;oldid=82323831" title="此页面该修订版本的固定链接"><span>固定链接</span></a></li><li id="t-info" class="mw-list-item"><a href="/w/index.php?title=Wikipedia:Lua&amp;action=info" title="关于此页面的更多信息"><span>页面信息</span></a></li><li id="t-urlshortener" class="mw-list-item"><a href="/w/index.php?title=Special:URL%E7%BC%A9%E7%9F%AD%E7%A8%8B%E5%BA%8F&amp;url=https%3A%2F%2Fzh.wikipedia.org%2Fwiki%2FWikipedia%3ALua"><span>获取短链接</span></a></li><li id="t-urlshortener-qrcode" class="mw-list-item"><a href="/w/index.php?title=Special:QrCode&amp;url=https%3A%2F%2Fzh.wikipedia.org%2Fwiki%2FWikipedia%3ALua"><span>下载二维码</span></a></li> </ul> </div> </div> <div id="p-electronpdfservice-sidebar-portlet-heading" class="vector-menu mw-portlet mw-portlet-electronpdfservice-sidebar-portlet-heading" > <div class="vector-menu-heading"> 打印/导出 </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="electron-print_pdf" class="mw-list-item"><a href="/w/index.php?title=Special:DownloadAsPdf&amp;page=Wikipedia%3ALua&amp;action=show-download-screen"><span>下载为PDF</span></a></li><li id="t-print" class="mw-list-item"><a href="javascript:print();" rel="alternate" title="本页面的可打印版本[p]" accesskey="p"><span>打印页面</span></a></li> </ul> </div> </div> <div id="p-wikibase-otherprojects" class="vector-menu mw-portlet mw-portlet-wikibase-otherprojects" > <div class="vector-menu-heading"> 在其他项目中 </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li class="wb-otherproject-link wb-otherproject-commons mw-list-item"><a href="https://commons.wikimedia.org/wiki/Commons:Lua" hreflang="en"><span>维基共享资源</span></a></li><li class="wb-otherproject-link wb-otherproject-mediawiki mw-list-item"><a href="https://www.mediawiki.org/wiki/Lua/Tutorial" hreflang="en"><span>MediaWiki</span></a></li><li class="wb-otherproject-link wb-otherproject-sources mw-list-item"><a href="https://wikisource.org/wiki/Wikisource:Lua_modules" hreflang="en"><span>多语言维基文库</span></a></li><li id="t-wikibase" class="wb-otherproject-link wb-otherproject-wikibase-dataitem mw-list-item"><a href="https://www.wikidata.org/wiki/Special:EntityPage/Q6811431" title="链接到连接的数据仓库项目[g]" accesskey="g"><span>维基数据项目</span></a></li> </ul> </div> </div> </div> </div> </div> </div> </nav> </div> </div> </div> <div class="vector-column-end"> <div class="vector-sticky-pinned-container"> <nav class="vector-page-tools-landmark" aria-label="页面工具"> <div id="vector-page-tools-pinned-container" class="vector-pinned-container"> </div> </nav> <nav class="vector-appearance-landmark" aria-label="外观"> <div id="vector-appearance-pinned-container" class="vector-pinned-container"> <div id="vector-appearance" class="vector-appearance vector-pinnable-element"> <div class="vector-pinnable-header vector-appearance-pinnable-header vector-pinnable-header-pinned" data-feature-name="appearance-pinned" data-pinnable-element-id="vector-appearance" data-pinned-container-id="vector-appearance-pinned-container" data-unpinned-container-id="vector-appearance-unpinned-container" > <div class="vector-pinnable-header-label">外观</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-appearance.pin">移至侧栏</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-appearance.unpin">隐藏</button> </div> </div> </div> </nav> </div> </div> <div id="bodyContent" class="vector-body" aria-labelledby="firstHeading" data-mw-ve-target-container> <div class="vector-body-before-content"> <div class="mw-indicators"> <div id="mw-indicator-noteTA-2dbd005c" class="mw-indicator"><div class="mw-parser-output"><span class="skin-invert" typeof="mw:File"><span title="本页使用了标题或全文手工转换"><img alt="本页使用了标题或全文手工转换" src="//upload.wikimedia.org/wikipedia/commons/thumb/c/cd/Zh_conversion_icon_m.svg/35px-Zh_conversion_icon_m.svg.png" decoding="async" width="35" height="22" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/c/cd/Zh_conversion_icon_m.svg/53px-Zh_conversion_icon_m.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/c/cd/Zh_conversion_icon_m.svg/70px-Zh_conversion_icon_m.svg.png 2x" data-file-width="32" data-file-height="20" /></span></span></div></div> </div> <div id="siteSub" class="noprint">维基百科,自由的百科全书</div> </div> <div id="contentSub"><div id="mw-content-subtitle"></div></div> <div id="mw-content-text" class="mw-body-content"><div class="mw-content-ltr mw-parser-output" lang="zh" dir="ltr"><div id="noteTA-2dbd005c" class="noteTA"><div class="noteTA-group"><div data-noteta-group-source="module" data-noteta-group="IT"></div><div data-noteta-group-source="module" data-noteta-group="MediaWiki"></div></div><div class="noteTA-local"><div data-noteta-code="zh-hans:通过; zh-hant:通過; zh-tw:透過;"></div></div></div> <table class="plainlinks ombox ombox-notice" role="presentation"><tbody><tr><td class="mbox-image"><span typeof="mw:File"><span><img alt="" src="//upload.wikimedia.org/wikipedia/commons/thumb/1/1d/Information_icon4.svg/40px-Information_icon4.svg.png" decoding="async" width="40" height="40" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/1/1d/Information_icon4.svg/60px-Information_icon4.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/1/1d/Information_icon4.svg/80px-Information_icon4.svg.png 2x" data-file-width="620" data-file-height="620"/></span></span></td><td class="mbox-text"><div style="padding-top: 6px; padding-bottom: 5px;"><b>本頁面為<a href="/wiki/Wikipedia:%E8%B3%87%E8%A8%8A%E9%A0%81" class="mw-redirect" title="Wikipedia:資訊頁">信息頁</a>。</b><br/><div style="font-size: 90%;">本信息頁不是<a href="/wiki/Wikipedia:%E6%96%B9%E9%87%9D%E8%88%87%E6%8C%87%E5%BC%95" title="Wikipedia:方針與指引">維基百科的方針或指引</a>之一,而是用於闡述維基百科某些方面的規範、慣例、技術細節或實踐方法,可能反映了維基社群一部分編者的<a href="/wiki/Wikipedia:%E5%85%B1%E8%AF%86" title="Wikipedia:共识">共識</a>。</div></div></td><td class="mbox-imageright"><style data-mw-deduplicate="TemplateStyles:r83102931">.mw-parser-output .shortcutbox{float:right;border:1px solid #aaa;background-color:var(--background-color-base,#fff);margin:0 0 0 1em;padding:.3em .6em .2em .6em;text-align:center;font-size:85%;font-weight:bold;white-space:nowrap}.mw-parser-output .shortcutbox-left{float:left}.mw-parser-output .shortcutbox-ombox{float:right;border-left:1px solid #aaa;padding:.4em 0em .4em 1em;text-align:center;line-height:1.4em;font-weight:bold;font-size:smaller;white-space:nowrap}.mw-parser-output .shortcutlist{display:inline-block;border-bottom:1px solid #aaa;margin-bottom:.2em;font-weight:normal}.mw-parser-output .shortcut-anchordiv{position:relative;top:-3em}.mw-parser-output .module-shortcutboxplain{float:right;border:1px solid #aaa;background-color:var(--background-color-base,#fff);margin:0 0 0 1em;padding:.3em .6em .2em .6em;text-align:center;font-size:85%;font-weight:bold;white-space:nowrap}.mw-parser-output .module-shortcutboxplain-left{float:left}.mw-parser-output .module-omboxshortcutplain{float:right;border-left:1px solid #aaa;padding:.4em 0em .4em 1em;text-align:center;line-height:1.4em;font-weight:bold;font-size:smaller;white-space:nowrap}.mw-parser-output .module-shortcutlist{display:inline-block;border-bottom:1px solid #aaa;margin-bottom:.2em;font-weight:normal}.mw-parser-output .module-shortcutanchordiv{position:relative;top:-3em}</style><div class="module-shortcutanchordiv"><span id="WP:LUA"></span></div><div class="module-shortcutboxplain plainlist noprint" role="note"><div class="module-shortcutlist"><a href="/wiki/Wikipedia:%E6%8D%B7%E5%BE%91" title="Wikipedia:捷徑">快捷方式</a></div><ul><li><span class="plainlinks"><a class="external text" href="https://zh.wikipedia.org/w/index.php?title=Wikipedia:LUA&amp;redirect=no">WP:LUA</a></span></li></ul></div></td></tr></tbody></table> <table class="wikitable" style="float: right; clear:right; text-align: center; font-size: 90%; margin-left: .6em;"> <tbody><tr> <th colspan="5" style="font-size:110%;"><a href="/wiki/Wikipedia:%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4" title="Wikipedia:命名空间">命名空间</a> </th></tr> <tr> <th colspan="3" class="skin-nightmode-reset-color" style="background-color:#ddd; color:inherit; border-right:solid; border-color: var(--border-color-base,#a2a9b1);"><a href="/wiki/Wikipedia:%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4#基本命名空间" title="Wikipedia:命名空间">基本命名空间</a> </th> <th colspan="2" class="skin-nightmode-reset-color" style="background-color:#ddd; color:inherit;"><a href="/wiki/Wikipedia:%E8%AE%A8%E8%AE%BA%E9%A1%B5" title="Wikipedia:讨论页">讨论命名空间</a> </th></tr> <tr> <th>0 </th> <td>(<a href="/wiki/Wikipedia:%E4%BB%80%E4%B9%88%E6%98%AF%E6%9D%A1%E7%9B%AE" title="Wikipedia:什么是条目">主/條目</a>) </td> <td style="border-right:solid; border-color: var(--border-color-base,#a2a9b1);"><small><a href="/wiki/Help:%E5%88%9B%E5%BB%BA%E6%96%B0%E6%9D%A1%E7%9B%AE" title="Help:创建新条目">帮助</a></small> </td> <td>讨论 </td> <th>1 </th></tr> <tr> <th>2 </th> <td><a href="/wiki/Wikipedia:%E7%94%A8%E6%88%B6%E9%A0%81" title="Wikipedia:用戶頁">用戶</a> </td> <td style="border-right:solid; border-color: var(--border-color-base,#a2a9b1);"><small><a href="/wiki/Help:%E7%94%A8%E6%88%B7%E9%A1%B5" title="Help:用户页">帮助</a></small> </td> <td>用户讨论 </td> <th>3 </th></tr> <tr> <th>4 </th> <td><a href="/wiki/Wikipedia:%E8%AE%A1%E5%88%92%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4" title="Wikipedia:计划命名空间">维基百科</a> </td> <td style="border-right:solid; border-color: var(--border-color-base,#a2a9b1);"> </td> <td>维基百科讨论 </td> <th>5 </th></tr> <tr> <th>6 </th> <td><a href="/wiki/Wikipedia:%E6%96%87%E4%BB%B6%E4%BD%BF%E7%94%A8%E6%96%B9%E9%92%88" title="Wikipedia:文件使用方针">文件</a> </td> <td style="border-right:solid; border-color: var(--border-color-base,#a2a9b1);"><small><a href="/wiki/Help:%E6%96%87%E4%BB%B6" title="Help:文件">帮助</a></small> </td> <td>文件讨论 </td> <th>7 </th></tr> <tr> <th>8 </th> <td><a href="/wiki/Wikipedia:MediaWiki%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4" title="Wikipedia:MediaWiki命名空间">MediaWiki</a> </td> <td style="border-right:solid; border-color: var(--border-color-base,#a2a9b1);"> </td> <td>MediaWiki讨论 </td> <th>9 </th></tr> <tr> <th>10 </th> <td><a href="/wiki/Wikipedia:%E6%A8%A1%E6%9D%BF%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4" title="Wikipedia:模板命名空间">模板</a> </td> <td style="border-right:solid; border-color: var(--border-color-base,#a2a9b1);"><small><a href="/wiki/Help:%E6%A8%A1%E6%9D%BF" title="Help:模板">帮助</a></small> </td> <td>模板讨论 </td> <th>11 </th></tr> <tr> <th>12 </th> <td><a href="/wiki/Help:%E7%9B%AE%E5%BD%95" title="Help:目录">帮助</a> </td> <td style="border-right:solid; border-color: var(--border-color-base,#a2a9b1);"> </td> <td>帮助讨论 </td> <th>13 </th></tr> <tr> <th>14 </th> <td><a href="/wiki/Wikipedia:%E9%A0%81%E9%9D%A2%E5%88%86%E9%A1%9E" title="Wikipedia:頁面分類">分类</a> </td> <td style="border-right:solid; border-color: var(--border-color-base,#a2a9b1);"><small><a href="/wiki/Help:%E5%88%86%E7%B1%BB" title="Help:分类">帮助</a></small> </td> <td>分类讨论 </td> <th>15 </th></tr> <tr> <th>100 </th> <td><a href="/wiki/Wikipedia:%E4%B8%BB%E9%A2%98" title="Wikipedia:主题">主题</a> </td> <td style="border-right:solid; border-color: var(--border-color-base,#a2a9b1);"> </td> <td>主题讨论 </td> <th>101 </th></tr> <tr> <th>102 </th> <td><a href="/wiki/Wikipedia:%E4%B8%93%E9%A2%98" title="Wikipedia:专题">維基專題</a> </td> <td style="border-right:solid; border-color: var(--border-color-base,#a2a9b1);"> </td> <td>維基專題討論 </td> <th>103 </th></tr> <tr> <th>118 </th> <td><a href="/wiki/Wikipedia:%E8%8D%89%E7%A8%BF%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4" title="Wikipedia:草稿命名空间">草稿</a> </td> <td style="border-right:solid; border-color: var(--border-color-base,#a2a9b1);"> </td> <td>草稿讨论 </td> <th>119 </th></tr> <tr> <th>126 </th> <td><a href="/wiki/Wikipedia:%E6%A0%BC%E5%BC%8F%E6%89%8B%E5%86%8C" title="Wikipedia:格式手册">格式手册快捷方式</a> </td> <td style="border-right:solid; border-color: var(--border-color-base,#a2a9b1);"><small><a href="/wiki/Wikipedia:%E6%8D%B7%E5%BE%91#偽命名空間" title="Wikipedia:捷徑">PNS</a></small> </td> <td>格式手册快捷方式讨论 </td> <th>127 </th></tr> <tr> <th>710 </th> <td><a href="https://www.mediawiki.org/wiki/Extension:TimedMediaHandler/zh" class="extiw" title="mw:Extension:TimedMediaHandler/zh">字幕</a> </td> <td style="border-right:solid; border-color: var(--border-color-base,#a2a9b1);"> </td> <td>字幕討論 </td> <th>711 </th></tr> <tr> <th>828 </th> <td><a class="mw-selflink selflink">模块</a> </td> <td style="border-right:solid; border-color: var(--border-color-base,#a2a9b1);"> </td> <td>模块讨论 </td> <th>829 </th></tr> <tr> <th>1728 </th> <td><a href="/wiki/Wikipedia:%E6%B4%BB%E5%8A%A8%E7%BB%84%E7%BB%87%E8%80%85" title="Wikipedia:活动组织者">活动</a> </td> <td style="border-right:solid; border-color: var(--border-color-base,#a2a9b1);"> </td> <td>活动讨论 </td> <th>1729 </th></tr> <tr> <th>2600 </th> <td><a href="/wiki/Wikipedia:%E7%B5%90%E6%A7%8B%E5%BC%8F%E8%A8%8E%E8%AB%96" title="Wikipedia:結構式討論">话题</a> </td> <td style="border-right:solid; border-color: var(--border-color-base,#a2a9b1);"><small><a href="/wiki/Help:%E7%B5%90%E6%A7%8B%E5%BC%8F%E8%A8%8E%E8%AB%96" title="Help:結構式討論">帮助</a></small> </td> <td> </td> <th> </th></tr> <tr> <th colspan="5" class="skin-nightmode-reset-color" style="background-color:#ddd; color:inherit;"><a href="/wiki/Wikipedia:%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4#虚拟命名空间" title="Wikipedia:命名空间">虚拟命名空间</a> </th></tr> <tr> <th>-1 </th> <td colspan="4"><a href="/wiki/Help:%E7%89%B9%E6%AE%8A%E9%A1%B5%E9%9D%A2" title="Help:特殊页面">特殊</a> </td></tr> <tr> <th>-2 </th> <td colspan="4"><a href="/wiki/Wikipedia:%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4#媒体命名空间" title="Wikipedia:命名空间">媒体</a> </td></tr> <tr> <td colspan="5" style="text-align:right; font-size:small;"><style data-mw-deduplicate="TemplateStyles:r84265675">.mw-parser-output .hlist dl,.mw-parser-output .hlist ol,.mw-parser-output .hlist ul{margin:0;padding:0}.mw-parser-output .hlist dd,.mw-parser-output .hlist dt,.mw-parser-output .hlist li{margin:0;display:inline}.mw-parser-output .hlist.inline,.mw-parser-output .hlist.inline dl,.mw-parser-output .hlist.inline ol,.mw-parser-output .hlist.inline ul,.mw-parser-output .hlist dl dl,.mw-parser-output .hlist dl ol,.mw-parser-output .hlist dl ul,.mw-parser-output .hlist ol dl,.mw-parser-output .hlist ol ol,.mw-parser-output .hlist ol ul,.mw-parser-output .hlist ul dl,.mw-parser-output .hlist ul ol,.mw-parser-output .hlist ul ul{display:inline}.mw-parser-output .hlist .mw-empty-li{display:none}.mw-parser-output .hlist dt::after{content:" :"}.mw-parser-output .hlist dd::after,.mw-parser-output .hlist li::after{content:" · ";font-weight:bold}.mw-parser-output .hlist-pipe dd::after,.mw-parser-output .hlist-pipe li::after{content:" | ";font-weight:normal}.mw-parser-output .hlist-hyphen dd::after,.mw-parser-output .hlist-hyphen li::after{content:" - ";font-weight:normal}.mw-parser-output .hlist-comma dd::after,.mw-parser-output .hlist-comma li::after{content:"、";font-weight:normal}.mw-parser-output .hlist dd:last-child::after,.mw-parser-output .hlist dt:last-child::after,.mw-parser-output .hlist li:last-child::after{content:none}.mw-parser-output .hlist ol{counter-reset:listitem}.mw-parser-output .hlist ol>li{counter-increment:listitem}.mw-parser-output .hlist ol>li::before{content:" "counter(listitem)"\a0 "}.mw-parser-output .hlist dd ol>li:first-child::before,.mw-parser-output .hlist dt ol>li:first-child::before,.mw-parser-output .hlist li ol>li:first-child::before{content:"("counter(listitem)"\a0 "}.mw-parser-output ul.cslist,.mw-parser-output ul.sslist{margin:0;padding:0;display:inline-block;list-style:none}.mw-parser-output .cslist li,.mw-parser-output .sslist li{margin:0;display:inline-block}.mw-parser-output .cslist li::after{content:","}.mw-parser-output .sslist li::after{content:";"}.mw-parser-output .cslist li:last-child::after,.mw-parser-output .sslist li:last-child::after{content:none}</style><style data-mw-deduplicate="TemplateStyles:r84244141">.mw-parser-output .navbar{display:inline;font-weight:normal}.mw-parser-output .navbar-collapse{float:left;text-align:left}.mw-parser-output .navbar-boxtext{word-spacing:0}.mw-parser-output .navbar ul{display:inline-block;white-space:nowrap;line-height:inherit}.mw-parser-output .navbar-brackets::before{margin-right:-0.125em;content:"[ "}.mw-parser-output .navbar-brackets::after{margin-left:-0.125em;content:" ]"}.mw-parser-output .navbar li{word-spacing:-0.125em}.mw-parser-output .navbar a>span,.mw-parser-output .navbar a>abbr{text-decoration:inherit}.mw-parser-output .navbar-mini abbr{font-variant:small-caps;border-bottom:none;text-decoration:none;cursor:inherit}.mw-parser-output .navbar-ct-full{font-size:110%;margin:0 8em}.mw-parser-output .navbar-ct-mini{font-size:110%;margin:0 5em}html.skin-theme-clientpref-night .mw-parser-output .navbar li a abbr{color:var(--color-base)!important}@media(prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .navbar li a abbr{color:var(--color-base)!important}}@media print{.mw-parser-output .navbar{display:none!important}}</style><div class="navbar plainlinks hlist navbar-mini"><ul><li class="nv-view"><a href="/wiki/Template:Namespaces" title="Template:Namespaces"><abbr title="查看该模板">查</abbr></a></li><li class="nv-talk"><a href="/wiki/Template_talk:Namespaces" title="Template talk:Namespaces"><abbr title="讨论该模板">论</abbr></a></li><li class="nv-edit"><a href="/wiki/Special:%E7%BC%96%E8%BE%91%E9%A1%B5%E9%9D%A2/Template:Namespaces" title="Special:编辑页面/Template:Namespaces"><abbr title="编辑该模板">编</abbr></a></li></ul></div> </td></tr></tbody></table> <p><a href="/wiki/Lua" title="Lua">Lua</a>編程語言目前通過MediaWiki上的<a href="/wiki/Wikipedia:%E8%A7%A3%E6%9E%90%E5%99%A8%E5%87%BD%E6%95%B0" class="mw-redirect" title="Wikipedia:解析器函数">解析器函数</a>外掛程式引入到中文維基百科當中使用。要在模板中嵌入Lua腳本,可加入解析器函数中的<code>{{#invoke:}}</code>功能。Lua原始碼存放在「模組」頁面中(如<a href="/wiki/Module:Example" title="Module:Example">模块:Example</a>),再以{{#invoke:}}來調用。模块页面本身不支持切换中文语言变体。 </p> <meta property="mw:PageProp/toc"/> <div class="mw-heading mw-heading2 ext-discussiontools-init-section"><h2 id="用法" data-mw-thread-id="h-用法"><span id=".E7.94.A8.E6.B3.95"></span><span data-mw-comment-start="" id="h-用法"></span>用法<span data-mw-comment-end="h-用法"></span></h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Wikipedia:Lua&amp;action=edit&amp;section=1" title="编辑章节:用法"><span>编辑</span></a><span class="mw-editsection-bracket">]</span></span><!--__DTELLIPSISBUTTON__{"threadItem":{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-\u7528\u6cd5","replies":["h-\u8fd0\u884c\u6a21\u5757-\u7528\u6cd5","h-\u904b\u7528\u53c3\u6578-\u7528\u6cd5"]}}--></div> <style data-mw-deduplicate="TemplateStyles:r85099211">.mw-parser-output .hatnote{font-size:small}.mw-parser-output div.hatnote{padding-left:2em;margin-bottom:0.8em;margin-top:0.8em}.mw-parser-output .hatnote-notice-img::after{content:"\202f \202f \202f \202f "}.mw-parser-output .hatnote-notice-img-small::after{content:"\202f \202f "}.mw-parser-output .hatnote+link+.hatnote{margin-top:-0.5em}body.skin-minerva .mw-parser-output .hatnote-notice-img,body.skin-minerva .mw-parser-output .hatnote-notice-img-small{display:none}@media print{body.ns-0 .mw-parser-output .hatnote{display:none!important}}</style><div role="note" class="hatnote navigation-not-searchable">主条目:<a href="https://www.mediawiki.org/wiki/Special:MyLanguage/Extension:Scribunto/Lua_reference_manual" class="extiw" title="mw:Special:MyLanguage/Extension:Scribunto/Lua reference manual">mw:Special:MyLanguage/Extension:Scribunto/Lua reference manual</a></div> <div class="mw-heading mw-heading3"><h3 id="运行模块" data-mw-thread-id="h-运行模块-用法"><span id=".E8.BF.90.E8.A1.8C.E6.A8.A1.E5.9D.97"></span><span data-mw-comment-start="" id="h-运行模块-用法"></span>运行模块<span data-mw-comment-end="h-运行模块-用法"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Wikipedia:Lua&amp;action=edit&amp;section=2" title="编辑章节:运行模块"><span>编辑</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>普通維基頁面通過#invoke分析器函數來調用模块。#invoke的句法與一般模板相似,但有些許不同。最重要的是必須指定函數名稱。函數會拿一組輸入值,通過一系列指令,輸出一個值。<sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>這和模板很像:輸入參數,模板運作後,輸出一個值。Lua模块中可以有多個函數,但單個模板則只能有一個。 </p><p>另外,模块不可以直接運行,而是有指定要運行的單個函數。模块是一組函數綜合起來的裝載體,自身並沒有功能。只有指定要運行哪一個函數,該模块才會知道要運行哪一個函數。 </p><p>最簡單的模块運行方法如下: </p> <pre>{{#invoke:模块名稱|函數名稱}}</pre> <p>例如,<a href="/wiki/Module:Example" title="Module:Example">Module:Example</a>就可以如此運行,其含有一個叫做「hello」的函數。 </p> <ul><li><code>{{<a class="mw-selflink selflink">#invoke</a>:<a href="/wiki/Module:Example" title="Module:Example">Example</a>|hello}}</code> → Hello, world!</li></ul> <div class="mw-heading mw-heading3"><h3 id="運用參數" data-mw-thread-id="h-運用參數-用法"><span id=".E9.81.8B.E7.94.A8.E5.8F.83.E6.95.B8"></span><span data-mw-comment-start="" id="h-運用參數-用法"></span>運用參數<span data-mw-comment-end="h-運用參數-用法"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Wikipedia:Lua&amp;action=edit&amp;section=3" title="编辑章节:運用參數"><span>编辑</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>參數進入模块腳本的方式與進入模板一樣。不過,在調用模块時第一個豎線之後必須要先指定函數名,第二個豎線之後才是正式參數。 </p> <pre>{{#invoke:模块名稱|函數名稱|第一參數|第二參數|帶名稱的參數 = 值}} </pre> <p>例如<a href="/wiki/Module:BaseConvert" title="Module:BaseConvert">Module:BaseConvert</a>可以轉換數值的進位制: </p> <ul><li><code>{{<a class="mw-selflink selflink">#invoke</a>:<a href="/wiki/Module:BaseConvert" title="Module:BaseConvert">BaseConvert</a>|convert|n=9|base=2}}</code> → 1001</li> <li><code>{{<a class="mw-selflink selflink">#invoke</a>:<a href="/wiki/Module:BaseConvert" title="Module:BaseConvert">BaseConvert</a>|convert|n=30|base=16}}</code> → 1E</li></ul> <p>运行模块时的参数会自动以table(表)类型的形式写入对应模块的<code class="mw-highlight mw-highlight-lang-lua mw-content-ltr" dir="ltr"><span class="n">frame</span><span class="p">.</span><span class="n">args</span></code>中,其中frame为函数的第一个参数。例如<code>{{<a class="mw-selflink selflink">#invoke</a>:<a href="/wiki/Module:BaseConvert" title="Module:BaseConvert">BaseConvert</a>|convert|n=30|base=16}}</code>就会自动给运行时的模块临时写入frame.args的值类似于<code class="mw-highlight mw-highlight-lang-lua mw-content-ltr" dir="ltr"><span class="p">{[</span><span class="s2">"n"</span><span class="p">]</span><span class="o">=</span><span class="s2">"30"</span><span class="p">;[</span><span class="s2">"base"</span><span class="p">]</span><span class="o">=</span><span class="s2">"16"</span><span class="p">}</span></code>,例如frame.args.n就会输出为30(字符串形式)。(注意:参数名称如果是数字,其frame.args中的参数名称也是数字,但参数值一定是一个字符串。这个args其实是使用了元表的。它的真正值为<code class="mw-highlight mw-highlight-lang-lua mw-content-ltr" dir="ltr"><span class="nb">getmetatable</span><span class="p">({},{</span><span class="n">__index</span><span class="o">=</span><span class="err">函数名</span><span class="p">,</span><span class="n">__pairs</span><span class="o">=</span><span class="err">函数名</span><span class="p">,</span><span class="n">__ipairs</span><span class="o">=</span><span class="err">函数名</span><span class="p">})</span></code>,因此如果需要制作一个纯粹的表以使用table.insert等函数,可以利用pairs进行迭代。) </p><p>此外,如果是引用调用了模块的页面,其引用时的值会写入模块的<code class="mw-highlight mw-highlight-lang-lua mw-content-ltr" dir="ltr"><span class="n">frame</span><span class="p">:</span><span class="n">getParent</span><span class="p">().</span><span class="n">args</span></code>中,例如(假设): </p> <ol><li>模块:Example的内容为:<div class="mw-highlight mw-highlight-lang-lua mw-content-ltr" dir="ltr"><pre><span></span><span class="kd">local</span> <span class="n">p</span><span class="o">=</span><span class="p">{}</span> <span class="kr">function</span> <span class="nc">p</span><span class="p">.</span><span class="nf">x</span><span class="p">(</span><span class="n">frame</span><span class="p">)</span> <span class="kr">return</span> <span class="n">frame</span><span class="p">:</span><span class="n">getParent</span><span class="p">().</span><span class="n">args</span><span class="p">[</span><span class="s2">"a"</span><span class="p">]</span> <span class="kr">end</span> <span class="kr">return</span> <span class="n">p</span> </pre></div></li> <li>Template:Example中的内容为:<pre>{{#invoke:Example|x}}</pre></li> <li>那么直接调用<code>{{<a class="mw-selflink selflink">#invoke</a>:<a href="/wiki/Module:Example" title="Module:Example">Example</a>|x|a=Hello world}}</code>是得不到任何内容的。</li> <li>但是使用<code style="white-space:nowrap;">{{Example|a=Hello world}}</code>就可以得到Hello world的字符串。</li></ol> <p>Scribunto对参数的处理有些限制,可参考<a href="/wiki/Module:Arguments" title="Module:Arguments">模块:Arguments</a>以了解如何使用该模块对参数进行进一步处理。 </p> <div class="mw-heading mw-heading2 ext-discussiontools-init-section"><h2 id="關於Lua" data-mw-thread-id="h-關於Lua"><span id=".E9.97.9C.E6.96.BCLua"></span><span data-mw-comment-start="" id="h-關於Lua"></span>關於Lua<span data-mw-comment-end="h-關於Lua"></span></h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Wikipedia:Lua&amp;action=edit&amp;section=4" title="编辑章节:關於Lua"><span>编辑</span></a><span class="mw-editsection-bracket">]</span></span><!--__DTELLIPSISBUTTON__{"threadItem":{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-\u95dc\u65bcLua","replies":[]}}--></div> <p>Lua是一種利用<a href="/wiki/%E5%A4%9A%E9%87%8D%E7%BC%96%E7%A8%8B%E8%8C%83%E5%BC%8F" class="mw-redirect" title="多重编程范式">多重编程范式</a>的腳本語言,可用於分析資料,計算公式及添加格式等。雖然Lua腳本可以非常簡單,但其功能強大,能夠支援各種複雜結構,如表格、動態函數等。Lua同時也支持含有自我嵌套函數的<a href="/wiki/%E9%80%92%E5%BD%92" title="递归">遞歸</a>過程。因此在設計Lua程式時,須注意不要加入過度複雜的組件,以免他人無法有效閱讀腳本。以下腳本(如在<a href="/wiki/Module:HelloWorld" title="Module:HelloWorld">Module:HelloWorld</a>)可以輸出Hello World!訊息: </p> <div class="mw-highlight mw-highlight-lang-lua mw-content-ltr" dir="ltr"><pre><span></span><span class="c1">-- 維基百科上的Lua模組必須在開頭定義一個變數,使參數可從外面存取。</span> <span class="c1">-- 變數的名稱可以含有資料。</span> <span class="kd">local</span> <span class="n">my_object</span> <span class="o">=</span> <span class="p">{};</span> <span class="c1">-- 在該變數上運行函數。在維基百科中可以用#invoke指令調用這些函數。</span> <span class="c1">-- 函數被調用時,維基百科會向函數發送資料。這一資料應包含在frame以內。</span> <span class="n">my_object</span><span class="p">.</span><span class="n">hello</span> <span class="o">=</span> <span class="kr">function</span><span class="p">(</span> <span class="n">frame</span> <span class="p">)</span> <span class="c1">-- 定義局部變數。</span> <span class="kd">local</span> <span class="n">str</span> <span class="o">=</span> <span class="s2">"Hello World!"</span> <span class="c1">-- 終止函數,並把str中的資料輸出到維基百科。</span> <span class="c1">-- 不可使用print函數,所以所有輸出要用return</span> <span class="kr">return</span> <span class="n">str</span> <span class="c1">-- 函數結束。</span> <span class="kr">end</span> <span class="c1">-- 模組底部須用return把帶有函數的變數送回維基百科。</span> <span class="kr">return</span> <span class="n">my_object</span> <span class="c1">-- 現在{{#invoke: HelloWorld | hello }}就可以調用以上函數了</span> <span class="c1">-- #invoke指令先指定模組名稱,HelloWorld,再指定某一函數,hello</span> </pre></div> <p>(注意:以上只是对模块用法的一个示例,如果要输入Hello World的字符串,最简单的用法如下:) </p> <div class="mw-highlight mw-highlight-lang-lua mw-content-ltr" dir="ltr"><pre><span></span><span class="kd">local</span> <span class="n">p</span> <span class="o">=</span> <span class="p">{}</span> <span class="kr">function</span> <span class="nc">p</span><span class="p">.</span><span class="nf">hello</span><span class="p">()</span> <span class="kr">return</span> <span class="s2">"Hello World!"</span> <span class="kr">end</span> <span class="kr">return</span> <span class="n">p</span> </pre></div> <p>Lua腳本在內文中可以加在<code class="mw-highlight mw-highlight-lang-wikitext mw-content-ltr" dir="ltr"><span class="p">&lt;</span><span class="nt">syntaxhighlight</span><span class="w"> </span><span class="na">lang</span><span class="o">=</span><span class="s2">"lua"</span><span class="p">>&lt;/</span><span class="nt">syntaxhighlight</span><span class="p">></span></code>裡面來加上顏色標註。詳見<a href="/wiki/Lua" title="Lua">Lua</a>條目。 </p><p>在MediaWiki中使用Lua的教程,可見<a href="https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual" class="extiw" title="mw:Extension:Scribunto/Lua reference manual">mw:Extension:Scribunto/Lua reference manual</a>。 </p> <div class="mw-heading mw-heading2 ext-discussiontools-init-section"><h2 id="單元測試" data-mw-thread-id="h-單元測試"><span id=".E5.96.AE.E5.85.83.E6.B8.AC.E8.A9.A6"></span><span data-mw-comment-start="" id="h-單元測試"></span>單元測試<span data-mw-comment-end="h-單元測試"></span></h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Wikipedia:Lua&amp;action=edit&amp;section=5" title="编辑章节:單元測試"><span>编辑</span></a><span class="mw-editsection-bracket">]</span></span><!--__DTELLIPSISBUTTON__{"threadItem":{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-\u55ae\u5143\u6e2c\u8a66","replies":[]}}--></div> <p><a href="/wiki/Module:UnitTests" title="Module:UnitTests">Module:UnitTests</a>提供Lua腳本的單元測試。它可用一組指定輸入值來運行特定腳本,並確認輸出值符合預期。單元測試可以很快地找到改變腳本後所產生的新問題。 </p><p>模块(如<a href="/wiki/Module:Example" title="Module:Example">Module:Example</a>)的單元測試應該放在其附頁<a href="/w/index.php?title=Module:Example/testcases&amp;action=edit&amp;redlink=1" class="new" title="Module:Example/testcases(页面不存在)">Module:Example/testcases</a>裡面,並在<a href="/w/index.php?title=Module_talk:Example/testcases&amp;action=edit&amp;redlink=1" class="new" title="Module talk:Example/testcases(页面不存在)">Module talk:Example/testcases</a>上用<code>{{#invoke:Example/testcases|run_tests}}</code>運行。測試方法必須以「test」開頭。以下是<a href="/w/index.php?title=Module:Example/testcases&amp;action=edit&amp;redlink=1" class="new" title="Module:Example/testcases(页面不存在)">Module:Example/testcases</a>的例子。 </p> <div class="mw-highlight mw-highlight-lang-lua mw-content-ltr" dir="ltr"><pre><span></span><span class="c1">-- [[Module:Example]]的單元測試。進入討論頁可運行測試。</span> <span class="kd">local</span> <span class="n">p</span> <span class="o">=</span> <span class="nb">require</span><span class="p">(</span><span class="s1">'Module:UnitTests'</span><span class="p">)</span> <span class="kr">function</span> <span class="nc">p</span><span class="p">:</span><span class="nf">test_hello</span><span class="p">()</span> <span class="n">self</span><span class="p">:</span><span class="n">preprocess_equals</span><span class="p">(</span><span class="s1">'{{#invoke:Example| hello}}'</span><span class="p">,</span> <span class="s1">'Hello, world!'</span><span class="p">)</span> <span class="kr">end</span> <span class="kr">return</span> <span class="n">p</span> </pre></div> <p><a href="/wiki/Special:%E9%93%BE%E5%85%A5%E9%A1%B5%E9%9D%A2/Module:UnitTests" title="Special:链入页面/Module:UnitTests">Special:Whatlinkshere/Module:UnitTests</a>頁面列出所有進行單元測試的模块。 </p> <div class="mw-heading mw-heading2 ext-discussiontools-init-section"><h2 id="MediaWiki特有功能" data-mw-thread-id="h-MediaWiki特有功能"><span id="MediaWiki.E7.89.B9.E6.9C.89.E5.8A.9F.E8.83.BD"></span><span data-mw-comment-start="" id="h-MediaWiki特有功能"></span>MediaWiki特有功能<span data-mw-comment-end="h-MediaWiki特有功能"></span></h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Wikipedia:Lua&amp;action=edit&amp;section=6" title="编辑章节:MediaWiki特有功能"><span>编辑</span></a><span class="mw-editsection-bracket">]</span></span><!--__DTELLIPSISBUTTON__{"threadItem":{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-MediaWiki\u7279\u6709\u529f\u80fd","replies":["h-Lua\u8f38\u5165\u503c\u9650\u5236-MediaWiki\u7279\u6709\u529f\u80fd","h-\u7dad\u57fa\u4ee3\u78bc-MediaWiki\u7279\u6709\u529f\u80fd"]}}--></div> <p><code>{{#invoke:}}</code>當中的輸入值在進入Lua腳本時一定是字符串格式。Lua只能輸出非包含及不含<code>{{...}}</code>的維基代碼。所有Lua腳本的CPU運行時間都限制在10秒。相比一般的Lua,Scribunto的Lua版本少了多個函數(見:<a href="https://www.mediawiki.org/wiki/Special:MyLanguage/Extension:Scribunto/Lua_reference_manual#Differences_from_standard_Lua" class="extiw" title="mw:Special:MyLanguage/Extension:Scribunto/Lua reference manual">mw:Special:MyLanguage/Extension:Scribunto/Lua reference manual#Differences from standard Lua</a>)。Scribunto也提供大量用于和MediaWiki对接的函数(<a href="https://www.mediawiki.org/wiki/Special:MyLanguage/Extension:Scribunto/Lua_reference_manual#Scribunto_libraries" class="extiw" title="mw:Special:MyLanguage/Extension:Scribunto/Lua reference manual">mw:Special:MyLanguage/Extension:Scribunto/Lua reference manual#Scribunto libraries</a>)。 </p> <div class="mw-heading mw-heading3"><h3 id="Lua輸入值限制" data-mw-thread-id="h-Lua輸入值限制-MediaWiki特有功能"><span id="Lua.E8.BC.B8.E5.85.A5.E5.80.BC.E9.99.90.E5.88.B6"></span><span data-mw-comment-start="" id="h-Lua輸入值限制-MediaWiki特有功能"></span>Lua輸入值限制<span data-mw-comment-end="h-Lua輸入值限制-MediaWiki特有功能"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Wikipedia:Lua&amp;action=edit&amp;section=7" title="编辑章节:Lua輸入值限制"><span>编辑</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Lua腳本只在頁面解析時才會運行。所以要對Lua輸入參數,必須通過「編輯此頁」,而不可在頁面中加入一個輸入框,作實時處理,也不可動態點擊挑選函數功能。Lua可以接受的輸入值包括任何「可包含」的文字頁面。這並不包括圖像文件(甚至.SVG文件都不可)和分類中的頁面列表等。 </p> <div class="mw-heading mw-heading3"><h3 id="維基代碼" data-mw-thread-id="h-維基代碼-MediaWiki特有功能"><span id=".E7.B6.AD.E5.9F.BA.E4.BB.A3.E7.A2.BC"></span><span data-mw-comment-start="" id="h-維基代碼-MediaWiki特有功能"></span>維基代碼<span data-mw-comment-end="h-維基代碼-MediaWiki特有功能"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Wikipedia:Lua&amp;action=edit&amp;section=8" title="编辑章节:維基代碼"><span>编辑</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>經「包含」的標題經常會有諸如「UNIQ5ae8f2aa414ff233-h-3--QINU」的隱藏文字(称为strip mark)。這些文字要去除之後才會有效解析。部分扩展标签也会转化为strip mark。 </p><p>類似[[Wikipedia:Help|]]的維基鏈接在經Lua輸出後是沒有用的,必須完整地寫成[[Wikipedia:Help|Help]]。其他保存前自動進行的轉換,如<code>~~~~</code>替換為簽名,都會在Lua輸出時無法進行(但在Lua函數被<a href="/wiki/Help:%E6%9B%BF%E6%8D%A2%E5%BC%95%E7%94%A8" title="Help:替换引用">特定條件</a>下還是會執行)。 </p><p>在Lua代码中隐藏文本(即进行<a href="/wiki/Help:%E6%B3%A8%E9%87%8A" class="mw-redirect" title="Help:注释">注释</a>,例如<a href="/wiki/Help:HTML" title="Help:HTML">HTML</a>中的<code class="mw-highlight mw-highlight-lang-html mw-content-ltr" dir="ltr"><span class="cm">&lt;!--...--></span></code>)的方法是在要<a href="https://zh.wikibooks.org/wiki/en:Lua_Programming/comment" class="extiw" title="b:en:Lua Programming/comment">注释</a>的文本前输入<code class="mw-highlight mw-highlight-lang-lua mw-content-ltr" dir="ltr"><span class="c1">--</span></code>(不能在字符串内)。也可使用 <code>--[[</code>开始大段注释,用<code>]]</code>结束。 </p><p>Lua不能进行<a href="/wiki/Help:%E9%AD%94%E6%9C%AF%E5%AD%97" title="Help:魔术字">魔术字</a>、<a href="/wiki/Help:%E6%A8%A1%E6%9D%BF" title="Help:模板">模板</a>、<a href="/wiki/Help:%E8%A7%A3%E6%9E%90%E5%99%A8%E5%87%BD%E6%95%B0" title="Help:解析器函数">解析器函数</a>的替换,否则会直接保留管道符和花括号(在<a href="/wiki/Special:%E5%B1%95%E5%BC%80%E6%A8%A1%E6%9D%BF" title="Special:展开模板">Special:展开模板</a>页面除外)。使用模板应该使用<code class="mw-highlight mw-highlight-lang-lua mw-content-ltr" dir="ltr"><span class="n">frame</span><span class="p">:</span><span class="n">expandTemplate</span><span class="p">{</span><span class="n">title</span> <span class="o">=</span> <span class="s2">"模板名稱(不含命名空間)"</span><span class="p">,</span> <span class="n">args</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"參數1"</span><span class="p">,</span> <span class="s2">"參數2"</span><span class="p">}}</span></code>,其中<code>frame</code>为函数中传入的框架对象,亦可通过<code>mw.getCurrentFrame()</code>获得。解析器函数和魔术字在Lua都有自带的函数,例如<code>{{FULLPAGENAME}}</code>应该用<code class="mw-highlight mw-highlight-lang-lua mw-content-ltr" dir="ltr"><span class="nb">tostring</span><span class="p">(</span><span class="n">mw</span><span class="p">.</span><span class="n">title</span><span class="p">.</span><span class="n">getCurrentTitle</span><span class="p">())</span></code>或者<code class="mw-highlight mw-highlight-lang-lua mw-content-ltr" dir="ltr"><span class="n">mw</span><span class="p">.</span><span class="n">title</span><span class="p">.</span><span class="n">getCurrentTitle</span><span class="p">().</span><span class="n">fullText</span></code>,具体用法参见<a href="https://www.mediawiki.org/wiki/Special:MyLanguage/Extension:Scribunto/Lua_reference_manual" class="extiw" title="mw:Special:MyLanguage/Extension:Scribunto/Lua reference manual">mw:Special:MyLanguage/Extension:Scribunto/Lua_reference_manual</a>。 </p><p><code style="white-space:nowrap;">&lt;ref></code>或<code style="white-space:nowrap;">&lt;nowiki></code>等標籤也不會在Lua程式當中處理。若要处理<code style="white-space:nowrap;">&lt;nowiki></code>,则应该使用<code class="mw-highlight mw-highlight-lang-lua mw-content-ltr" dir="ltr"><span class="n">mw</span><span class="p">.</span><span class="n">text</span><span class="p">.</span><span class="n">nowiki</span><span class="p">(</span><span class="s2">"原文本"</span><span class="p">)</span></code>。 </p> <div class="mw-heading mw-heading2 ext-discussiontools-init-section"><h2 id="使用Lua的模板" data-mw-thread-id="h-使用Lua的模板"><span id=".E4.BD.BF.E7.94.A8Lua.E7.9A.84.E6.A8.A1.E6.9D.BF"></span><span data-mw-comment-start="" id="h-使用Lua的模板"></span>使用Lua的模板<span data-mw-comment-end="h-使用Lua的模板"></span></h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Wikipedia:Lua&amp;action=edit&amp;section=9" title="编辑章节:使用Lua的模板"><span>编辑</span></a><span class="mw-editsection-bracket">]</span></span><!--__DTELLIPSISBUTTON__{"threadItem":{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-\u4f7f\u7528Lua\u7684\u6a21\u677f","replies":[]}}--></div> <p>基于Lua语言编写的<b>模板的文档页面</b>应当加上<code>{{<a href="/wiki/Template:Lua" class="mw-redirect" title="Template:Lua">lua</a>|模組名稱}}</code>: </p> <table class="plainlinks ombox mbox-small ombox-notice" role="presentation"><tbody><tr><td class="mbox-image"><span typeof="mw:File"><span><img alt="" src="//upload.wikimedia.org/wikipedia/commons/thumb/c/cf/Lua-Logo.svg/30px-Lua-Logo.svg.png" decoding="async" width="30" height="30" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/c/cf/Lua-Logo.svg/45px-Lua-Logo.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/c/cf/Lua-Logo.svg/60px-Lua-Logo.svg.png 2x" data-file-width="947" data-file-height="947"/></span></span></td><td class="mbox-text">此模板使用<a class="mw-selflink selflink">Lua语言</a>: <div><ul><li><a href="/wiki/Module:Test" title="Module:Test">Module:Test</a>(<a href="/wiki/Module:Test/sandbox" title="Module:Test/sandbox">沙盒</a>)</li></ul></div></td></tr></tbody></table> <p>之后这些模板会归入<a href="/wiki/Category:Lua%E6%A8%A1%E6%9D%BF" title="Category:Lua模板">Category:Lua模板</a>及其子分类中,你可以在这个分类中找到这些模板。请勿将模块归入此分类。 </p> <div class="mw-heading mw-heading2 ext-discussiontools-init-section"><h2 id="资源" data-mw-thread-id="h-资源"><span id=".E8.B5.84.E6.BA.90"></span><span data-mw-comment-start="" id="h-资源"></span>资源<span data-mw-comment-end="h-资源"></span></h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Wikipedia:Lua&amp;action=edit&amp;section=10" title="编辑章节:资源"><span>编辑</span></a><span class="mw-editsection-bracket">]</span></span><!--__DTELLIPSISBUTTON__{"threadItem":{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-\u8d44\u6e90","replies":["h-\u6587\u6863-\u8d44\u6e90","h-\u6307\u5357-\u8d44\u6e90","h-Lua\u76f8\u5173\u6587\u7ae0-\u8d44\u6e90","h-\u6a21\u5757\u94fe\u63a5\u5217\u8868-\u8d44\u6e90"]}}--></div> <div class="mw-heading mw-heading3"><h3 id="文档" data-mw-thread-id="h-文档-资源"><span id=".E6.96.87.E6.A1.A3"></span><span data-mw-comment-start="" id="h-文档-资源"></span>文档<span data-mw-comment-end="h-文档-资源"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Wikipedia:Lua&amp;action=edit&amp;section=11" title="编辑章节:文档"><span>编辑</span></a><span class="mw-editsection-bracket">]</span></span></div> <ul><li><a href="https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual" class="extiw" title="mw:Extension:Scribunto/Lua reference manual">Scribunto Lua 参考手册</a></li> <li><a rel="nofollow" class="external text" href="http://www.lua.org/pil/contents.html#P1">Lua编程</a></li> <li><a rel="nofollow" class="external text" href="http://lua-users.org/wiki/PatternsTutorial">Lua样式介绍</a></li> <li><a rel="nofollow" class="external text" href="http://www.regular-expressions.info/">About regex</a> 基于<a href="/wiki/Regex" class="mw-redirect" title="Regex">Regex</a>的Lua样式</li></ul> <div class="mw-heading mw-heading3"><h3 id="指南" data-mw-thread-id="h-指南-资源"><span id=".E6.8C.87.E5.8D.97"></span><span data-mw-comment-start="" id="h-指南-资源"></span>指南<span data-mw-comment-end="h-指南-资源"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Wikipedia:Lua&amp;action=edit&amp;section=12" title="编辑章节:指南"><span>编辑</span></a><span class="mw-editsection-bracket">]</span></span></div> <ul><li><a href="/wiki/Wikipedia:Lua%E4%BB%A3%E7%A0%81%E9%A3%8E%E6%A0%BC" title="Wikipedia:Lua代码风格">维基百科:Lua代码风格</a> – 通过连贯性改进可读性的标准</li> <li><a href="/wiki/File:WMF_Tech_Talk_2013-02-28_slides_-_Scribunto_presentation.pdf" title="File:WMF Tech Talk 2013-02-28 slides - Scribunto presentation.pdf">"What do converted templates look like?" (slideshow)</a></li> <li><a href="https://en.wikipedia.org/wiki/Help:Lua_debugging" class="extiw" title="en:Help:Lua debugging">en:Help:Lua debugging</a> – <a href="/wiki/%E8%B0%83%E8%AF%95" title="调试">调试</a>Lua模块的指南</li> <li><a href="https://en.wikipedia.org/wiki/Help:Lua_for_beginners" class="extiw" title="en:Help:Lua for beginners">en:Help:Lua for beginners</a></li> <li><a href="https://en.wikipedia.org/wiki/Wikipedia:Lua_string_functions" class="extiw" title="en:Wikipedia:Lua string functions">en:Wikipedia:Lua string functions</a></li> <li><a href="https://en.wikipedia.org/wiki/Wikipedia:Guide_to_Scribbling" class="extiw" title="en:Wikipedia:Guide to Scribbling">en:Wikipedia:Guide to Scribbling</a> – 怎样用Scribunto/Lua编写模板</li> <li><a href="https://en.wikipedia.org/wiki/Wikiversity:Lua" class="extiw" title="en:Wikiversity:Lua">en:Wikiversity:Lua</a> – Lua指引</li></ul> <div class="mw-heading mw-heading3"><h3 id="Lua相关文章" data-mw-thread-id="h-Lua相关文章-资源"><span id="Lua.E7.9B.B8.E5.85.B3.E6.96.87.E7.AB.A0"></span><span data-mw-comment-start="" id="h-Lua相关文章-资源"></span>Lua相关文章<span data-mw-comment-end="h-Lua相关文章-资源"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Wikipedia:Lua&amp;action=edit&amp;section=13" title="编辑章节:Lua相关文章"><span>编辑</span></a><span class="mw-editsection-bracket">]</span></span></div> <ul><li><a href="https://en.wikipedia.org/wiki/Wikipedia:Lua_speed" class="extiw" title="en:Wikipedia:Lua speed">en:Wikipedia:Lua speed</a> – 比较模板和模块速度</li> <li><a href="https://en.wikipedia.org/wiki/Wikipedia:Lua_articles" class="extiw" title="en:Wikipedia:Lua articles">en:Wikipedia:Lua articles</a></li> <li><a href="https://en.wikipedia.org/wiki/User:Dragons_flight/Lua_performance" class="extiw" title="en:User:Dragons flight/Lua performance">en:User:Dragons flight/Lua performance</a></li> <li><a href="https://en.wikipedia.org/wiki/Wikipedia:Lua_unit_testing" class="extiw" title="en:Wikipedia:Lua unit testing">en:Wikipedia:Lua unit testing</a></li> <li><a href="https://www.mediawiki.org/wiki/User:Sumanah/Lua_vs_Javascript" class="extiw" title="mw:User:Sumanah/Lua vs Javascript">mw:User:Sumanah/Lua vs Javascript</a></li> <li><cite class="citation web">Roberto Ierusalimschy. <a rel="nofollow" class="external text" href="http://www.lua.org/gems/sample.pdf">Lua Performance Tips</a> <span style="font-size:85%;">(PDF)</span>. lua.org.</cite><span title="ctx_ver=Z39.88-2004&amp;rfr_id=info%3Asid%2Fzh.wikipedia.org%3AWikipedia%3ALua&amp;rft.au=Roberto+Ierusalimschy&amp;rft.btitle=Lua+Performance+Tips&amp;rft.genre=unknown&amp;rft.pub=lua.org&amp;rft_id=http%3A%2F%2Fwww.lua.org%2Fgems%2Fsample.pdf&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook" class="Z3988"><span style="display:none;"> </span></span></li></ul> <div class="mw-heading mw-heading3"><h3 id="模块链接列表" data-mw-thread-id="h-模块链接列表-资源"><span id=".E6.A8.A1.E5.9D.97.E9.93.BE.E6.8E.A5.E5.88.97.E8.A1.A8"></span><span data-mw-comment-start="" id="h-模块链接列表-资源"></span>模块链接列表<span data-mw-comment-end="h-模块链接列表-资源"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Wikipedia:Lua&amp;action=edit&amp;section=14" title="编辑章节:模块链接列表"><span>编辑</span></a><span class="mw-editsection-bracket">]</span></span></div> <ul><li><code>{{<a href="/wiki/Template:Lmd" title="Template:Lmd">lmd</a>|Test}}</code>用于生成模块链接:<span class="plainlinks nourlexpansion lx"><a href="/wiki/Module:Test" title="Module:Test">Module:Test</a>(<a class="external text" href="https://zh.wikipedia.org/w/index.php?title=Module:Test&amp;action=edit">编辑</a> | <a href="/w/index.php?title=Module_talk:Test&amp;action=edit&amp;redlink=1" class="new" title="Module talk:Test(页面不存在)">讨论</a> | <a class="external text" href="https://zh.wikipedia.org/w/index.php?title=Module:Test&amp;action=history">历史</a> | <a class="external text" href="https://zh.wikipedia.org/w/index.php?title=Special:Whatlinkshere/Module:Test&amp;limit=999">链接</a> | <a class="external text" href="https://zh.wikipedia.org/w/index.php?title=Module:Test&amp;action=watch">监视</a> | <a class="external text" href="https://zh.wikipedia.org/w/index.php?title=Special:Log&amp;page=Module%3ATest">日志</a>)</span></li></ul> <ol class="references"> <li id="cite_note-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-1">^</a></b></span> <span class="reference-text">也可以有多個輸出值,但這類函數一般不用於#invoke中。</span> </li> </ol> <!-- NewPP limit report Parsed by mw‐api‐int.codfw.main‐58b97c867d‐g4k5s Cached time: 20241125192423 Cache expiry: 2592000 Reduced expiry: false Complications: [show‐toc] DiscussionTools time usage: 0.057 seconds CPU time usage: 0.498 seconds Real time usage: 0.609 seconds Preprocessor visited node count: 1324/1000000 Post‐expand include size: 235206/2097152 bytes Template argument size: 1105/2097152 bytes Highest expansion depth: 10/100 Expensive parser function count: 20/500 Unstrip recursion depth: 0/20 Unstrip post‐expand size: 13318/5000000 bytes Lua time usage: 0.187/10.000 seconds Lua memory usage: 4002746/52428800 bytes Number of Wikibase entities loaded: 0/400 --> <!-- Transclusion expansion time report (%,ms,calls,template) 100.00% 334.255 1 -total 28.70% 95.944 1 Template:NoteTA 22.03% 73.626 1 Template:Infopage 20.36% 68.051 1 Template:Ombox 14.86% 49.660 1 Template:Namespaces 13.83% 46.220 1 Template:Navbar 12.21% 40.817 1 Template:Cite_web 10.32% 34.483 1 Template:Shortcut 5.35% 17.879 1 Template:Main 3.96% 13.230 1 Template:Lua --> <!-- Saved in parser cache with key zhwiki:pcache:idhash:3807368-0!canonical!zh and timestamp 20241125192423 and revision id 82323831. Rendering was triggered because: api-parse --> </div><!--esi <esi:include src="/esitest-fa8a495983347898/content" /> --><noscript><img src="https://login.wikimedia.org/wiki/Special:CentralAutoLogin/start?type=1x1" alt="" width="1" height="1" style="border: none; position: absolute;"></noscript> <div class="printfooter" data-nosnippet="">检索自“<a dir="ltr" href="https://zh.wikipedia.org/w/index.php?title=Wikipedia:Lua&amp;oldid=82323831">https://zh.wikipedia.org/w/index.php?title=Wikipedia:Lua&amp;oldid=82323831</a>”</div></div> <div id="catlinks" class="catlinks" data-mw="interface"><div id="mw-normal-catlinks" class="mw-normal-catlinks"><a href="/wiki/Special:%E9%A1%B5%E9%9D%A2%E5%88%86%E7%B1%BB" title="Special:页面分类">分类</a>:​<ul><li><a href="/wiki/Category:%E7%B6%AD%E5%9F%BA%E7%99%BE%E7%A7%91%E8%B3%87%E8%A8%8A%E9%A0%81" title="Category:維基百科資訊頁">維基百科資訊頁</a></li><li><a href="/wiki/Category:Lua%E6%A8%A1%E6%9D%BF" title="Category:Lua模板">Lua模板</a></li></ul></div></div> </div> </main> </div> <div class="mw-footer-container"> <footer id="footer" class="mw-footer" > <ul id="footer-info"> <li id="footer-info-lastmod"> 本页面最后修订于2024年4月19日 (星期五) 13:15。</li> <li id="footer-info-copyright">本站的全部文字在<a rel="nofollow" class="external text" href="//creativecommons.org/licenses/by-sa/4.0/deed.zh">知识共享 署名-相同方式共享 4.0协议</a>之条款下提供,附加条款亦可能应用。(请参阅<a class="external text" href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Terms_of_Use">使用条款</a>)<br /> Wikipedia&#174;和维基百科标志是<a rel="nofollow" class="external text" href="https://wikimediafoundation.org/zh">维基媒体基金会</a>的注册商标;维基&#8482;是维基媒体基金会的商标。<br /> 维基媒体基金会是按美国国內稅收法501(c)(3)登记的<a class="external text" href="https://donate.wikimedia.org/wiki/Special:MyLanguage/Tax_deductibility">非营利慈善机构</a>。<br /></li> </ul> <ul id="footer-places"> <li id="footer-places-privacy"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy">隐私政策</a></li> <li id="footer-places-about"><a href="/wiki/Wikipedia:%E5%85%B3%E4%BA%8E">关于维基百科</a></li> <li id="footer-places-disclaimers"><a href="/wiki/Wikipedia:%E5%85%8D%E8%B4%A3%E5%A3%B0%E6%98%8E">免责声明</a></li> <li id="footer-places-wm-codeofconduct"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Universal_Code_of_Conduct">行为准则</a></li> <li id="footer-places-developers"><a href="https://developer.wikimedia.org">开发者</a></li> <li id="footer-places-statslink"><a href="https://stats.wikimedia.org/#/zh.wikipedia.org">统计</a></li> <li id="footer-places-cookiestatement"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Cookie_statement">Cookie声明</a></li> <li id="footer-places-mobileview"><a href="//zh.m.wikipedia.org/w/index.php?title=Wikipedia:Lua&amp;mobileaction=toggle_view_mobile" class="noprint stopMobileRedirectToggle">手机版视图</a></li> </ul> <ul id="footer-icons" class="noprint"> <li id="footer-copyrightico"><a href="https://wikimediafoundation.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><img src="/static/images/footer/wikimedia-button.svg" width="84" height="29" alt="Wikimedia Foundation" loading="lazy"></a></li> <li id="footer-poweredbyico"><a href="https://www.mediawiki.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><img src="/w/resources/assets/poweredby_mediawiki.svg" alt="Powered by MediaWiki" width="88" height="31" loading="lazy"></a></li> </ul> </footer> </div> </div> </div> <div class="vector-settings" id="p-dock-bottom"> <ul></ul> </div><script>(RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgHostname":"mw-web.codfw.main-694cf4987f-cxcsj","wgBackendResponseTime":157,"wgDiscussionToolsPageThreads":[{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-用法","replies":[{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-运行模块-用法","replies":[]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-運用參數-用法","replies":[]}]},{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-關於Lua","replies":[]},{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-單元測試","replies":[]},{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-MediaWiki特有功能","replies":[{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Lua輸入值限制-MediaWiki特有功能","replies":[]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-維基代碼-MediaWiki特有功能","replies":[]}]},{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-使用Lua的模板","replies":[]},{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-资源","replies":[{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-文档-资源","replies":[]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-指南-资源","replies":[]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Lua相关文章-资源","replies":[]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-模块链接列表-资源","replies":[]}]}],"wgPageParseReport":{"discussiontools":{"limitreport-timeusage":"0.057"},"limitreport":{"cputime":"0.498","walltime":"0.609","ppvisitednodes":{"value":1324,"limit":1000000},"postexpandincludesize":{"value":235206,"limit":2097152},"templateargumentsize":{"value":1105,"limit":2097152},"expansiondepth":{"value":10,"limit":100},"expensivefunctioncount":{"value":20,"limit":500},"unstrip-depth":{"value":0,"limit":20},"unstrip-size":{"value":13318,"limit":5000000},"entityaccesscount":{"value":0,"limit":400},"timingprofile":["100.00% 334.255 1 -total"," 28.70% 95.944 1 Template:NoteTA"," 22.03% 73.626 1 Template:Infopage"," 20.36% 68.051 1 Template:Ombox"," 14.86% 49.660 1 Template:Namespaces"," 13.83% 46.220 1 Template:Navbar"," 12.21% 40.817 1 Template:Cite_web"," 10.32% 34.483 1 Template:Shortcut"," 5.35% 17.879 1 Template:Main"," 3.96% 13.230 1 Template:Lua"]},"scribunto":{"limitreport-timeusage":{"value":"0.187","limit":"10.000"},"limitreport-memusage":{"value":4002746,"limit":52428800}},"cachereport":{"origin":"mw-api-int.codfw.main-58b97c867d-g4k5s","timestamp":"20241125192423","ttl":2592000,"transientcontent":false}}});});</script> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10