莲花是什么生肖| 直白是什么意思| 下呼吸道感染吃什么药| 晚上七点多是什么时辰| 眼压高是什么原因| 3月18日什么星座| 早上起来口干口苦口臭是什么原因| 一 什么云| 鼻咽癌有什么症状| 晚上难以入睡是什么原因| 肝脑涂地是什么意思| 维生素检查项目叫什么| 金银花为什么叫忍冬| 弊端是什么意思| 什么枝什么叶| 什么时候拔罐最好| 暗渡陈仓什么意思| 雨五行属什么| 上火引起的喉咙痛吃什么药| 什么是b站| 低密度结节是什么意思| 喝咖啡有什么坏处| 胃不舒服喝什么| 11月13日什么星座| 天丝是什么材料| 一厢情愿指什么生肖| 印第安老斑鸠什么意思| 成语什么争鸣| 为什么总长火疖子| 骨感是什么意思| 鲍温病是什么病| 0604是什么日子| 违反禁令标志指示什么意思| ca什么意思| 腋下疼痛是什么原因| 阴阳两虚吃什么| 月经调理吃什么好| 霸王花是什么花| 乳钉的作用是什么| 脑供血不足吃什么药好| 一丝不苟是什么生肖| 洋人是什么意思| 葡萄胎是什么| vp是什么| 山药有什么功效和作用| 飞舞是什么意思| 重复肾是什么意思| 菊花什么时候种植| 头皮屑多的原因是什么| 流清鼻涕吃什么药| 4.13什么星座| 海豹吃什么| 杜鹃花什么时候开| 蓝风铃香水什么味道| mr检查是什么| 腿部青筋明显是什么原因| 怕金病帕金森是什么症状| 杀生电影讲的什么意思| 发烧吃什么食物比较好| 仲夏是什么意思| 彩虹为什么有七种颜色| 费力不讨好是什么生肖| 比萨斜塔为什么是斜的| 抖腿是什么原因| 瞎子吃核桃砸了手是什么生肖| 疣吃什么药能治好| 紫外线是什么| 前胸后背疼挂什么科| 经常过敏是什么原因| 余事勿取是什么意思| 女人吃什么补充胶原蛋白| 天地银行是什么意思| oc是什么意思| 属鼠和什么属相相冲| 小辣椒是什么意思| 杞人忧天是什么故事| 手心痒痒是什么预兆| 内膜欠均匀是什么意思| 舌尖溃疡是什么原因| 抗美援朝什么时候结束| 断头婚是什么意思| 吃了牛肉不能吃什么| 厌氧菌是什么| 前列腺增生吃什么药最好| 尿蛋白质弱阳性是什么意思| 酒糟鼻买什么药膏去红| 早上十点是什么时辰| 什么人容易得白塞氏病| 王朝马汉是什么意思| 经常打屁是什么原因| 卡姿兰属于什么档次| 什么茶助眠| 麻疹的症状是什么| 疏朗是什么意思| 好学不倦什么意思| 回族信仰什么教| 老保是什么意思| 落叶像什么飘落下来| 眼皮有痣代表什么| 通草长什么样图片| 小孩脚抽筋是什么原因引起的| 泳字五行属什么| 首鼠两端是什么意思| 万事如意是什么生肖| 吃什么可以补精子| 腰疼吃什么| 常态是什么意思| 什么色什么异| 睡鼠吃什么| 什么是脂溢性皮炎| 天后是什么意思| 云南白药有什么功效| 秦朝之前是什么朝代| 外面下着雨犹如我心血在滴什么歌| rem睡眠是什么意思| ala是什么氨基酸| 脚代表什么生肖| 硬不起吃什么药| 铉是什么意思| 什么水果对胃好| cdfi是什么意思| 梅毒螺旋体抗体阳性是什么意思| 五味子长什么样| 沙拉酱可以做什么美食| 婴儿喝什么奶粉最好| 喝什么茶叶减肥效果最好| 梦见大黑蛇是什么预兆| 水垢是什么| 处女座跟什么星座最配| 千秋无绝色悦目是佳人什么意思| 胆在什么位置| 什么瓜不能吃| 吃芒果后不能吃什么| 来月经前胸胀痛什么原因| 皮牙子是什么意思| 1990年是什么命| 卵圆孔未闭挂什么科| 请柬写伉俪什么意思| 哺乳期头痛可以吃什么药| prn是什么医嘱| 肺热吃什么药| 银屑病用什么药最好| 五点多是什么时辰| 妲己是什么生肖| 胆囊疼是什么原因| 做梦数钱是什么意思啊| 拉肚子胃疼吃什么药| a和ab型生的孩子是什么血型| 泥鳅喜欢吃什么食物| 什么罩杯最大| 6月9日是什么星座| 肝不好挂什么科室| 吃什么助消化| 眼睛流水是什么原因| 吃黑木耳有什么好处| 老是瞌睡是什么原因| 怕冷又怕热是什么原因| 皇协军是什么意思| 丛林法则是什么意思| 96年是什么年| 柴米油盐什么意思| 火龙果对身体有什么好处| 芒硝是什么东西| pr间期延长是什么意思| 瘙痒是什么意思| 内向男生适合什么工作| 奇点是什么意思| 为什么手臂上有很多很小的点| 早餐吃什么英语怎么说| 月经期后是什么期| 英语6级是什么水平| 特别能睡觉是什么原因引起的| 梦见手机坏了是什么意思| 胎囊是什么| 父母都是a型血孩子是什么血型| 六月十四号是什么星座| 红枣为什么要去核煮| 什么掌不能拍| 8.8是什么星座| 苦瓜汤为什么要放黄豆| 50年属什么| 老是放屁什么原因| 金银花和什么搭配喝好| 人格独立是什么意思| 飞短流长是什么意思| 什么的食物| 做nt需要准备什么| 背疼挂什么科室最好| 9月25号什么星座| 一九七二年属什么生肖| 盈字五行属什么| 翼字五行属什么| 壁虎喜欢吃什么| 老年人全身无力是什么原因| 氟哌噻吨美利曲辛片治什么病| 捉代表什么生肖| 温州有什么特产| 梦见火灾预示什么| pin什么意思| 文定之喜是什么意思| 摆架子是什么意思| 日字旁跟什么有关| 拉肚子可以吃什么食物| 什么茶养胃又治胃病| 王妃是什么意思| 茴三硫片主治什么| 梦见老公出轨预示什么| 卵泡不破是什么原因| 头上爱出汗是什么原因| 梦见洗车是什么意思| 甘油三酯高吃什么好| 生的反义词是什么| 炖鸡汤用什么鸡| 什么是传染性软疣| 打板是什么意思| 溥仪为什么没有后代| 甘油三酯高是什么意思| 右下腹疼痛什么原因| 屎壳郎长什么样| 凝血四项能查出什么病| 离岸人民币什么意思| 淋巴细胞绝对值偏高是什么意思| 眼有眼屎是什么原因| 痔疮是什么意思| 微量元素6项是查什么| 地头蛇比喻什么样的人| 鱼龙混杂什么意思| 农历7月20日是什么星座| 糖尿病人早餐吃什么最好| 新生儿甲状腺偏高有什么影响| 孕妇吃黑芝麻对胎儿有什么好处| 0206是什么星座| 脂溢性皮炎是什么原因引起的| 洁面液是干什么用的| 为什么会血压高| 什么主皮毛| 泥鳅吃什么| 脸上长粉刺是什么原因引起的| au999是什么金| 儿童喉咙痒咳嗽吃什么药| 桦树茸有什么作用| 宰相的宰最早指什么| 千张炒什么好吃| 属猴与什么属相最配| 晚上夜尿多吃什么药| 尿道炎吃什么| 大便羊粪状吃什么药| 心梗有什么症状| 毛主席为什么不进故宫| 暖和的什么| 小指麻木是什么原因| 遥不可及是什么意思| 血糖高喝什么稀饭好| 肝脏在人体什么位置| 海子为什么自杀| 屁眼疼痛什么原因| 地蛋是什么| 时至今日是什么意思| 属兔生什么属相宝宝好| 耳朵里面痒是什么原因| 什么样的季节| 左甲状腺是什么病| 白脖什么意思| 猫发出咕噜咕噜的声音是什么意思| 百度

中兴中路南段及安惠大道沥青改造工程勘察招标公告

百度 二要牢固树立党章意识。

This module includes a number of functions for dealing with Lua tables. It is a meta-module, meant to be called from other Lua modules, and should not be called directly from #invoke.

Loading the module

edit

To use any of the functions, first you must load the module.

local TableTools = require('Module:TableTools')

isPositiveInteger

edit
TableTools.isPositiveInteger(value)

Returns true if value is a positive integer, and false if not. Although it doesn't operate on tables, it is included here as it is useful for determining whether a given table key is in the array part or the hash part of a table.

isNan

edit
TableTools.isNan(value)

Returns true if value is a NaN value, and false if not. Although it doesn't operate on tables, it is included here as it is useful for determining whether a value can be a valid table key. (Lua will generate an error if a NaN value is used as a table key.)

shallowClone

edit
TableTools.shallowClone(t)

Returns a clone of a table. The value returned is a new table, but all subtables and functions are shared. Metamethods are respected, but the returned table will have no metatable of its own. If you want to make a new table with no shared subtables and with metatables transferred, you can use mw.clone instead. If you want to make a new table with no shared subtables and without metatables transferred, use deepCopy with the noMetatable option.

removeDuplicates

edit
TableTools.removeDuplicates(t)

Removes duplicate values from an array. This function is only designed to work with standard arrays: keys that are not positive integers are ignored, as are all values after the first nil value. (For arrays containing nil values, you can use compressSparseArray first.) The function tries to preserve the order of the array: the earliest non-unique value is kept, and all subsequent duplicate values are removed. For example, for the table {5, 4, 4, 3, 4, 2, 2, 1} removeDuplicates will return {5, 4, 3, 2, 1}.

numKeys

edit
TableTools.numKeys(t)

Takes a table t and returns an array containing the numbers of any positive integer keys that have non-nil values, sorted in numerical order. For example, for the table {'foo', nil, 'bar', 'baz', a = 'b'}, numKeys will return {1, 3, 4}.

affixNums

edit
TableTools.affixNums(t, prefix, suffix)

Takes a table t and returns an array containing the numbers of keys with the optional prefix prefix and the optional suffix suffix. For example, for the table {a1 = 'foo', a3 = 'bar', a6 = 'baz'} and the prefix 'a', affixNums will return {1, 3, 6}. All characters in prefix and suffix are interpreted literally.

See {{#invoke:params|call_for_each_group}} and {{#invoke:params|grouping_by_calling}} for doing something similar from a wiki template.

numData

edit
TableTools.numData(t, compress)

Given a table with keys like "foo1", "bar1", "foo2", and "baz2", returns a table of subtables in the format { [1] = {foo = 'text', bar = 'text'}, [2] = {foo = 'text', baz = 'text'} }. Keys that don't end with an integer are stored in a subtable named "other". The compress option compresses the table so that it can be iterated over with ipairs.

compressSparseArray

edit
TableTools.compressSparseArray(t)

Takes an array t with one or more nil values, and removes the nil values while preserving the order, so that the array can be safely traversed with ipairs. Any keys that are not positive integers are removed. For example, for the table {1, nil, foo = 'bar', 3, 2}, compressSparseArray will return {1, 3, 2}.

See {{#invoke:params|squeezing}} for doing something similar from a wiki template.

sparseIpairs

edit
TableTools.sparseIpairs(t)

This is an iterator function for traversing a sparse array t. It is similar to ipairs, but will continue to iterate until the highest numerical key, whereas ipairs may stop after the first nil value. Any keys that are not positive integers are ignored.

Usually sparseIpairs is used in a generic for loop.

for i, v in TableTools.sparseIpairs(t) do
   -- code block
end

Note that sparseIpairs uses the pairs function in its implementation. Although some table keys appear to be ignored, all table keys are accessed when it is run.

size

edit
TableTools.size(t)

Finds the size of a key/value pair table (associative array). For example, for {foo = 'foo', bar = 'bar'}, size will return 2. The function will also work on arrays, but for arrays it is more efficient to use the # operator. Note that to find the size, this function uses the pairs function to iterate through all of the keys.

keysToList

edit
TableTools.keysToList(t, keySort, checked)

Returns a list of the keys in a table, sorted using either a default comparison function or a custom keySort function, which follows the same rules as the comp function supplied to table.sort. If keySort is false, no sorting is done. Set checked to true to skip the internal type checking.

sortedPairs

edit
TableTools.sortedPairs(t, keySort)

Iterates through a table, with the keys sorted using the keysToList function. If there are only numerical keys, sparseIpairs is probably more efficient.

isArray

edit
TableTools.isArray(value)

Returns true if value is a table and all keys are consecutive integers starting at 1.

isArrayLike

edit
TableTools.isArrayLike(value)

Returns true if value is iterable and all keys are consecutive integers starting at 1.

invert

edit
TableTools.invert(arr)

Transposes the keys and values in an array. For example, invert{ "a", "b", "c" } yields { a=1, b=2, c=3 }.

listToSet

edit
TableTools.listToSet(arr)

Creates a set from the array part of the table arr. Indexing the set by any of the values of the array returns true. For example, listToSet{ "a", "b", "c" } yields { a=true, b=true, c=true }.

deepCopy

edit
TableTools.deepCopy(orig, noMetatable, alreadySeen)

Creates a copy of the table orig. As with mw.clone, all values that are not functions are duplicated and the identity of tables is preserved. If noMetatable is true, then the metatable (if any) is not copied. Can copy tables loaded with mw.loadData.

Similar to mw.clone, but mw.clone cannot copy tables loaded with mw.loadData and does not allow metatables not to be copied.

sparseConcat

edit
TableTools.sparseConcat(t, sep, i, j)

Concatenates all values in the table that are indexed by a positive integer, in order. For example, sparseConcat{ "a", nil, "c", "d" } yields "acd" and sparseConcat{ nil, "b", "c", "d" } yields "bcd".

length

edit
TableTools.length(t, prefix)

Finds the length of an array or of a quasi-array with keys with an optional prefix such as "data1", "data2", etc. It uses an exponential search algorithm to find the length, so as to use as few table lookups as possible.

This algorithm is useful for arrays that use metatables (e.g. frame.args) and for quasi-arrays. For normal arrays, just use the # operator, as it is implemented in C and will be quicker.

inArray

edit
TableTools.inArray(array, searchElement)
TableTools.inArray(array, searchElement, fromIndex)

Returns true if searchElement is a member of the array array, and false otherwise. Equivalent to the javascript Array.prototype.includes() function, except fromIndex is 1-indexed instead of zero-indexed.

fromIndex

edit

fromIndex is the optional 1-based index at which to start searching. If fromIndex is not present, all values in the array will be searched and the array will be treated as a table/associative array (it will be iterated over using pairs()).

If fromIndex is present and an integer, the array is assumed to be a conventional array/sequence/list (indexed with consecutive integer keys starting at 1, and interated over using ipairs()). Only the values whose index is fromIndex or higher will be searched.

In the following examples, #array represents the length of the integer-keyed portion of the array.

  • If fromIndex < 0 it will count back from the end of the array, e.g. a value of -1 will only search the last integer-keyed element in the array. If fromIndex <= (-1 * #array), the entire integer-keyed portion of the array will be searched.
  • If fromIndex = 0 it will be treated as a 1 and the entire integer-keyed portion of the array will be searched.
  • If fromIndex > #array, the array is not searched and false is returned.

merge

edit
TableTools.merge(...)

Given the arrays, returns an array containing the elements of each input array in sequence.

extend

edit
TableTools.extend(arr1, arr2)

Extends the first array in place by appending all elements from the second array.

See also

edit


什么叫同型半胱氨酸 黑色记号笔用什么能擦掉 dbp是什么意思 请婚假需要什么材料 如火如荼什么意思
什么叫点映 什么叫高潮 啪啪啪是什么意思 怀孕做无创是查什么 人鱼小姐大结局是什么
706代血浆又叫什么 秦始皇是芈月的什么人 零和博弈是什么意思 肤色是什么颜色 白玫瑰代表什么意思
真知灼见什么意思 甲钴胺是治什么病的 跌打损伤挂什么科 肩胛骨疼痛是什么原因 软组织损伤是什么意思
清茶是什么茶hcv8jop4ns2r.cn 恐龙什么时候灭绝的hcv9jop5ns8r.cn 睾丸小是什么原因hcv9jop4ns2r.cn 做梦梦到水是什么征兆hcv9jop4ns5r.cn 羊水偏多对胎儿有什么影响hcv7jop6ns4r.cn
红外线是什么hcv9jop0ns0r.cn 光明会到底是干什么的hcv9jop3ns8r.cn 三伏天是什么时候开始hcv8jop5ns1r.cn 什么粥养胃hcv8jop3ns3r.cn 倒拔垂杨柳是什么意思hcv8jop4ns1r.cn
滥情什么意思hcv9jop7ns1r.cn 民政局局长什么级别hcv8jop4ns3r.cn 易烊千玺是什么星座hcv8jop0ns5r.cn 文献是什么0735v.com 93什么意思hcv8jop3ns6r.cn
水土不服吃什么药hcv8jop4ns1r.cn 痰多是什么原因hcv7jop5ns4r.cn 什么叫桥本甲状腺炎tiangongnft.com 溥仪和慈禧什么关系beikeqingting.com cd138阳性是什么意思baiqunet.com
百度