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