Module:参数/文档

来自植物大战僵尸百科
跳转到导航 跳转到搜索

这是Module:参数的文档页面

本模組是元模組,在其他模組中用於加載參數模組。

模組內容

p

本模組的返回值。

p.getMsg(frame)
從框架對象frame接收參數。frame.args是表,第一項爲參數模組頁面名字串,第二項爲鍵名字串,返回值。
p.loadData(source)
輸入參數模組source字串,必須帶有命名空間,必須使用頁面原名。返回對應資料的參數ts對象,參數模組的返回值在ts._data中。

ts

ts:msg{ key = key, sub = sub, pre = pre, args = args }
ts:msg{ key, sub, ... }
ts:msg(opts, ...)
ts:msg(key, ...)
輸入內容說明:
key
鍵名字串。
sub
子鍵名字串,預設爲數字1
pre
二元,是否預處理返回的訊息,預設爲假false
args
參數表。
...
參數表中各項的值。
opts
設定表,包括keysub(或subkey)、preargsargs...不應同時輸入。
找到的訊息爲ts._data[key],如果其是表,則改爲ts._data[key][sub]。將其中的$dd爲從1開始的整數)替換爲args{ ... }中對應的值。之後根據pre決定是否預處理並返回結果。
ts:parameter(key, args)
key爲鍵名字串,args爲參數表。若p等於key,且之後會遍歷ts._data[key]中提供的參數名,則返回第一個找到的args[p]
ts:numberedParameter(key, num, args)
ts:parameter相似,但要輸入數字numkey中用%d標出了數字num在參數名稱中的位置。
ts:compare(key, compare)
key爲鍵名字串,compare爲要對比的字串。若p等於key,且之後會遍歷ts._data[key]中提供的參數名,找到第一個匹配的args[p]時返回真true,否則返回假false