(创建页面,内容为“{{顶栏|图片=无框|标题=底层模块|内容=它提供了支柱功能,请讨论后修改。}} 这是个基础模块,用了个…”)
 
无编辑摘要
第1行: 第1行:
{{顶栏|图片=[[文件:Icon-product.png|无框]]|标题=底层模块|内容=它提供了支柱功能,请讨论后修改。}}
{{顶栏|图片=[[文件:Icon-product.png|无框]]|标题=底层模块|内容=它提供了支柱功能,请讨论后修改。}}


这是个基础模块,用了个很新手的名字:Hello Lua,但这也确实是我首次使用 Lua 这门语言 ——
这是个基础模块,曾经用了个很新手的名字:Hello Lua,但这也确实是我首次使用 Lua 这门语言 ——
下面是这个基础模块的功能列表和详细用法。
下面是这个基础模块的功能列表和详细用法。


第13行: 第13行:
  ! 备注
  ! 备注
  |-
  |-
  | [[模块:Hello Lua/doc#getURL()|getURL()]]
  | [[模块:Basic/doc#getURL()|getURL()]]
  | 获取当前界面的 URL
  | 获取当前界面的 URL
  | -
  | -
第19行: 第19行:
  | -
  | -
  |-
  |-
  | [[模块:Hello Lua/doc#strCat()|strCat(string, string)]]
  | [[模块:Basic/doc#strCat()|strCat(string, string)]]
  | 连接两个字符串
  | 连接两个字符串
  | 两个字符串参数
  | 两个字符串参数
第25行: 第25行:
  | -
  | -
  |-
  |-
  | [[模块:Hello Lua/doc#getStat()|getStat(string)]]
  | [[模块:Basic/doc#getStat()|getStat(string)]]
  | 获取站点统计信息
  | 获取站点统计信息
  | 统计的类型,参见 [[mediawikiwiki:Extension:Scribunto/Lua_reference_manual/zh#mw.site.stats|mw.site.stats]]
  | 统计的类型,参见 [[mediawikiwiki:Extension:Scribunto/Lua_reference_manual/zh#mw.site.stats|mw.site.stats]]
第31行: 第31行:
  | -
  | -
  |-
  |-
  | [[模块:Hello Lua/doc#gethitokoto()|gethitokoto()]]
  | [[模块:Basic/doc#gethitokoto()|gethitokoto()]]
  | 获取一言
  | 获取一言
  | 是否显示from(一言出处),默认false
  | 是否显示from(一言出处),默认false
第40行: 第40行:
=== getURL() ===
=== getURL() ===
获取当前界面的 URL。
获取当前界面的 URL。
  <nowiki>{{#invoke:Hello Lua|getURL}}</nowiki>
  <nowiki>{{#invoke:Basic|getURL}}</nowiki>


  {{#invoke:Hello Lua|getURL}}
  {{#invoke:Basic|getURL}}


=== srtCat() ===
=== srtCat() ===
连接两个字符串。
连接两个字符串。
  <nowiki>{{#invoke:Hello Lua|strCat|This is the text| and add text}}</nowiki>
  <nowiki>{{#invoke:Basic|strCat|This is the text| and add text}}</nowiki>


  {{#invoke:Hello Lua|strCat|This is the text| and add text}}
  {{#invoke:Basic|strCat|This is the text| and add text}}


=== getStat() ===
=== getStat() ===
获取站点统计信息
获取站点统计信息
  <nowiki>{{#invoke:Hello Lua|getStat|articles}}</nowiki>
  <nowiki>{{#invoke:Basic|getStat|articles}}</nowiki>


  DHW PCS WIKI 目前总文章数:{{#invoke:Hello Lua|getStat|articles}}
  DHW PCS WIKI 目前总文章数:{{#invoke:Basic|getStat|articles}}


===  gethitokoto() ===
===  gethitokoto() ===
获取一言( https://hitokoto.cn )
获取一言( https://hitokoto.cn )
  <nowiki>{{#invoke:Hello Lua|gethitokoto|true}}</nowiki>
  <nowiki>{{#invoke:Basic|gethitokoto|true}}</nowiki>


  {{#invoke:Hello Lua|gethitokoto|true}}
  {{#invoke:Basic|gethitokoto|true}}


== 计划函数 ==
== 计划函数 ==
第92行: 第92行:
  | -
  | -
|}
|}
  {{#invoke:Hello Lua|hello}}
  {{#invoke:Basic|hello}}


  {{#invoke:Hello Lua|inPut|inPut1}}
  {{#invoke:Basic|inPut|inPut1}}


  {{#invoke:Hello Lua|nowPage}}
  {{#invoke:Basic|nowPage}}

2020年8月26日 (三) 11:49的版本

Icon-product.png
底层模块
它提供了支柱功能,请讨论后修改。


这是个基础模块,曾经用了个很新手的名字:Hello Lua,但这也确实是我首次使用 Lua 这门语言 —— 下面是这个基础模块的功能列表和详细用法。

实战函数

这些函数已经完善并且可以正常使用。

函数名 简介 参数 返回值 备注
getURL() 获取当前界面的 URL - 对应的无主域名编码 URL -
strCat(string, string) 连接两个字符串 两个字符串参数 连接完成的一个字符串 -
getStat(string) 获取站点统计信息 统计的类型,参见 mw.site.stats 统计数值 -
gethitokoto() 获取一言 是否显示from(一言出处),默认false - -

getURL()

获取当前界面的 URL。

{{#invoke:Basic|getURL}}
/%E6%A8%A1%E5%9D%97:Basic/doc

srtCat()

连接两个字符串。

{{#invoke:Basic|strCat|This is the text| and add text}}
This is the text and add text

getStat()

获取站点统计信息

{{#invoke:Basic|getStat|articles}}
DHW PCS WIKI 目前总文章数:49

gethitokoto()

获取一言( https://hitokoto.cn

{{#invoke:Basic|gethitokoto|true}}
谎话被歌颂,扮清醒的人作哑装聋。 —— 不痛

计划函数

这些函数正在制作中,暂时无法使用但是已经存在计划。

学习函数

这些函数没有使用意义,仅仅是我用来学习 Lua 和 Mediawiki 的。

函数名 简介 参数 返回值 备注
hello() 输出 Hello, Lua! - - -
inPut(frame) 输出获取到的第一个参数 随意参数 - -
nowPage() 获取当前界面标题 - - -
Hello, Lua!
inPut1
模块:Basic/doc