属马的跟什么属相最配| 摇呼啦圈有什么好处| 看心脏病挂什么科| 脑供血不足做什么检查能查出来| 吃了兔子肉不能吃什么| 胎心快是什么原因| 芒果不能和什么水果一起吃| 甲沟炎用什么药膏| 欲情故纵什么意思| 肾结石要注意什么| 治股癣用什么药最好| usp是什么意思| 坐围是什么| l5s1椎间盘突出是什么意思| 食管反流吃什么药最好| 右眼皮跳是什么预兆男| 斑点狗是什么品种| 缺维生素d有什么症状| 乳头内陷挂什么科| 乙肝核心抗体高是什么意思| 什么是多囊卵巢综合症| 敏感肌是什么意思| 浑身疼吃什么药管用| 肉丝炒什么菜好吃| 天罗地网是什么意思| 轻度肠上皮化生是什么意思| 承德有什么大学| 怀孕前三个月不能吃什么| 颠鸾倒凤什么意思| 哈喇味是什么味道| 肚脐眼的作用是什么| 胎儿fl是什么意思| 过年吃什么| 脚趾缝脱皮是什么原因| 牙齿黄用什么牙膏| 肚脐右边按压疼是什么原因| 委屈什么意思| 色令智昏是什么意思| 喝水呛咳是什么原因| 溺水是什么意思| 过敏性紫癜是什么症状| 身上长白点是什么原因| 吓着了有什么症状| 马蜂菜什么人不能吃| 什么的英语单词| 巡视员是什么级别| 血小板平均体积偏高是什么意思| 阴道有褐色分泌物是什么原因| 什么是先天之本| 渗透压偏高是什么原因| 洗衣机什么牌子最好| 农历五月二十八是什么日子| 痛风会在膝盖什么位置| 副高是什么职称| 护士是干什么的| 欣字取名什么寓意| 入坑是什么意思| 其余是什么意思| 悬饮是什么意思| 女生左手中指戴戒指什么意思| 孩子反复发烧是什么原因| 大惊小怪是什么意思| 给小孩办身份证需要什么| 肝硬化是什么| 四月是什么星座| 肠胃消化不好吃什么食物| 做爱女生是什么感觉| 宝宝细菌感染吃什么药| 什么样的人容易得脑梗| 汲水什么意思| rh血型是什么意思| 凌晨两点半是什么时辰| 硝苯地平是什么药| 三唑仑是什么药| 什么app可以买烟| 手发胀是什么原因| 小个子适合什么发型| 人棉是什么面料| 铁蛋白低是什么意思| 波尔多红是什么颜色| 有炎症吃什么药| 疤痕增生是什么引起的| thenorthface是什么牌子| bm什么意思| 梦见打老虎是什么预兆| 头痛吃什么| 上睑下垂是什么原因造成的| 介入手术是什么意思| 肺部有问题一般会出现什么症状| 顶针什么意思| 为什么白天能看到月亮| 欧巴什么意思| 一个米一个更念什么| 耳道发炎用什么药| 千锤百炼什么意思| 孕妇可以吃什么感冒药| 为伊消得人憔悴什么意思| 衣字旁的字和什么有关| 牙齿一碰就疼是什么原因| 格拉苏蒂手表什么档次| 心脏供血不足是什么原因引起的| 什么奶粉好吸收好消化| 下焦湿热吃什么药| 头孢克肟和头孢拉定有什么区别| 阴历七月是什么星座| 抑郁症吃什么药| 诺如病毒感染吃什么药| 肩膀骨头疼是什么原因| h的大写字母是什么| 凝滞是什么意思| 同人文是什么意思| 春秋是一部什么体史书| 阿司匹林治什么病| 秋天有什么特点| 看见老鼠有什么预兆| 世界上最小的花是什么花| 脚突然肿了是什么原因| 7月28是什么星座| 淋巴癌有什么症状| 头晕四肢无力是什么原因| mri检查是什么| 亥五行属什么| 石斛有什么功效和作用| 属狗是什么命| 尿血应该挂什么科| 尿蛋白高是什么原因引起的| 胸痛一阵一阵的痛什么原因| 猪肚炖什么好吃| 什么水果治便秘| 什么叫正盐| 心灵鸡汤是什么意思| 五爷是什么菩萨| 发际线高的人说明什么| 什么药治胃炎效果好| 主心骨是什么意思| 吃什么排铅最快| 抑郁症是什么原因造成| 珍珠是用什么做的| 营业执照什么时候年审| 肆无忌惮的意思是什么| 钠对人体有什么作用| 隔岸观火是什么意思| 斑鸠和鸽子有什么区别| 似乎是什么意思| 肌无力是什么病| 人为什么做梦| daddy什么意思| 祭日是什么意思| 舅舅的孙子叫我什么| 用脚尖走路有什么好处| 管教有方是什么意思| 脑梗吃什么药| 哥哥的孩子叫我什么| 项羽字什么| 少一个肾有什么影响| 婴儿吓着了有什么症状| 甲亢吃什么药| 先天性心脏病有什么症状| 剪不断理还乱是什么意思| 血脂高喝什么茶好| 左肝钙化灶是什么意思| 红枣和枸杞一起泡水喝有什么作用| 为什么会得甲亢| 木五行属什么| 胎毒是什么意思| 阿尔茨海默症是什么| 大地色眼影是什么颜色| 满血复活是什么意思| 毕业典礼送什么花| 夏天喝什么饮料好| 什么叫智商| 2018年生肖属什么| 嘌呤是什么意思| 高手过招下一句是什么| 不愁吃穿是什么生肖| 什么是盗汗症状| 仓鼠突然死了是为什么| 椅子像什么| 胃热吃什么药| 跳蛋是什么意思| 什么样的梦才算是胎梦| 泌乳素高有什么症状| 同等学力是什么意思| 浪子是什么意思| 闻字五行属什么| 马是什么牌子的车| 师傅是什么意思| 吃什么可以来月经最快最有效| 六月初二是什么日子| 右手大拇指发麻是什么原因| 灰指甲用什么药最好| 孕妇吃梨有什么好处| 长白眉毛是什么征兆| 股票杠杆是什么意思| 一个令一个瓦念什么| vinegar是什么意思| 充饥是什么意思| 下身痒是什么原因| 什么是个性| 顿服是什么意思| 1964年是什么年| 静夜思是什么季节| 湿气重的人吃什么好| 东倒西歪是什么意思| 黄油可以做什么美食| 麒麟臂什么意思| 突然头晕想吐是什么原因| 米线里的麻油是什么油| 血糖高的人吃什么水果好| 不够时间好好来爱你是什么歌| 发什么什么大| modal是什么意思| 预拌粉是什么东西| 脑炎的后遗症是什么| 高烧不退有什么好办法| 什么护肤品比较好| 什么洗发水去屑效果好| 低头头晕是什么原因| 蚕蛹是什么| 全身冰凉是什么原因| 什么东东是什么意思| 降钙素原检测是查什么的| 三黄鸡为什么那么便宜| 自字五行属什么| 什么药补气血效果最好| 收缩压和舒张压是什么| 怀孕什么时候打胎最合适| 二狗子是什么意思| 食欲不振是什么意思| 凝血常规是查什么的| 拉血挂什么科| 中度贫血是什么原因造成的| 雷人是什么意思| 属虎的幸运色是什么颜色| nak是什么牌子| 手机账号是什么| 周杰伦是什么星座| 心心相什么| e2是什么意思| 男性长期熬夜吃什么好| 诺五行属什么| 喉咙有异物感吃什么药| 朋友搬家送什么礼物好| 中国国花是什么花| 阿莫西林和头孢有什么区别| 地球为什么自转| 当归是什么| cmf是什么| camel什么意思| 什么是虎牙| 时过境迁什么意思| 男生进入是什么感觉| 泉字五行属什么| 熬夜伤什么| 净身出户什么意思| 一什么铃铛| 游坦之练的什么武功| 痛风病人吃什么菜| 吃藕是什么意思| 梦见好多老鼠是什么意思| 鬼死了叫什么| 手术后为什么不让睡觉| 站街女是什么意思| 大连机场叫什么| 百度Jump to content

“粉色之恋”花展亮相新加坡滨海湾花园

Permanently protected module
From mediawiki.org
Module documentation
warning Warning:This page is shared between multiple wikis.
All changes to this page will be automatically copied to all wikis listed in the left side bar.
To avoid unnecessary page regeneration and server load, changes should be tested on the page's sandbox.
百度 比如,当前中央国家机关各部门机关党委编制力量普遍薄弱,人少事多、“小马拉大车”问题突出,无法适应全面从严治党需要。

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.

Module Quality

Test Status
Module:TableTools success: 9, error: 0, skipped: 0
Module:TableTools/sandbox success: 9, error: 0, skipped: 0

Loading the module

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

local TableTools = require('Module:TableTools')

Functions

isPositiveInteger

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

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

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

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

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

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.

numData

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

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}

sparseIpairs

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

TableTools.size(t)

Finds the size of a key/value pair table.

For example, for the table
{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 table size, this function uses the pairs function to iterate through all of the table keys.

keysToList

TableTools.keysToList(t, keySort)

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 .

sortedPairs

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

TableTools.isArray(t)

Returns true if all keys in the table are consecutive integers starting at 1.

listToSet

TableTools.listToSet(arr)

Creates a set from the array part of the table arr. Indexing the set by any of the values in arr returns true.

local set = TableTools.listToSet { "a", "b", "c" }
assert(set["a"] === true)

invert

TableTools.invert(t)

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

deepCopy

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

TableTools.sparseConcat(t, sep)

Concatenates all values in the table that are indexed by a positive integer, in order.

length

TableTools.length(t)

Returns the length of a table, or the first integer key n counting from 0 such that t[n + 1] is nil. It is similar to the operator #, but may return a different value when there are gaps in the array portion of the table. Intended to be used on data loaded with mw.loadData and on frame.args. Both use a metatable such that #mw.loadData("module:...") and #frame.args don't work correctly. For other tables, use #.

inArray

TableTools.inArray(arr, valueToFind)

Returns true if valueToFind is a member of the array arr, and false otherwise.

--[[
------------------------------------------------------------------------------------
--                               TableTools                                       --
--                                                                                --
-- 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.                                           --
------------------------------------------------------------------------------------
--]]

local libraryUtil = require('libraryUtil')

local p = {}

-- Define often-used variables and functions.
local floor = math.floor
local infinity = math.huge
local checkType = libraryUtil.checkType
local checkTypeMulti = libraryUtil.checkTypeMulti

--[[
------------------------------------------------------------------------------------
-- isPositiveInteger
--
-- This function returns true if the given 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.
------------------------------------------------------------------------------------
--]]
function p.isPositiveInteger(v)
	if type(v) == 'number' and v >= 1 and floor(v) == v and v < infinity then
		return true
	else
		return false
	end
end

--[[
------------------------------------------------------------------------------------
-- isNan
--
-- This function returns true if the given number 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 is used as a table key.
------------------------------------------------------------------------------------
--]]
function p.isNan(v)
	if type(v) == 'number' and tostring(v) == '-nan' then
		return true
	else
		return false
	end
end

--[[
------------------------------------------------------------------------------------
-- shallowClone
--
-- This 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.
------------------------------------------------------------------------------------
--]]
function p.shallowClone(t)
	local ret = {}
	for k, v in pairs(t) do
		ret[k] = v
	end
	return ret
end

--[[
------------------------------------------------------------------------------------
-- removeDuplicates
--
-- This removes duplicate values from an array. Non-positive-integer keys are
-- ignored. The earliest value is kept, and all subsequent duplicate values are
-- removed, but otherwise the array order is unchanged.
------------------------------------------------------------------------------------
--]]
function p.removeDuplicates(t)
	checkType('removeDuplicates', 1, t, 'table')
	local isNan = p.isNan
	local ret, exists = {}, {}
	for i, v in ipairs(t) do
		if isNan(v) then
			-- NaNs can't be table keys, and they are also unique, so we don't need to check existence.
			ret[#ret + 1] = v
		else
			if not exists[v] then
				ret[#ret + 1] = v
				exists[v] = true
			end
		end	
	end
	return ret
end			

--[[
------------------------------------------------------------------------------------
-- numKeys
--
-- This takes a table and returns an array containing the numbers of any numerical
-- keys that have non-nil values, sorted in numerical order.
------------------------------------------------------------------------------------
--]]
function p.numKeys(t)
	checkType('numKeys', 1, t, 'table')
	local isPositiveInteger = p.isPositiveInteger
	local nums = {}
	for k, v in pairs(t) do
		if isPositiveInteger(k) then
			nums[#nums + 1] = k
		end
	end
	table.sort(nums)
	return nums
end

--[[
------------------------------------------------------------------------------------
-- affixNums
--
-- This takes a table and returns an array containing the numbers of keys with the
-- specified prefix and suffix. For example, for the table
-- {a1 = 'foo', a3 = 'bar', a6 = 'baz'} and the prefix "a", affixNums will
-- return {1, 3, 6}.
------------------------------------------------------------------------------------
--]]
function p.affixNums(t, prefix, suffix)
	checkType('affixNums', 1, t, 'table')
	checkType('affixNums', 2, prefix, 'string', true)
	checkType('affixNums', 3, suffix, 'string', true)

	local function cleanPattern(s)
		-- Cleans a pattern so that the magic characters ()%.[]*+-?^$ are interpreted literally.
		s = s:gsub('([%(%)%%%.%[%]%*%+%-%?%^%$])', '%%%1')
		return s
	end

	prefix = prefix or ''
	suffix = suffix or ''
	prefix = cleanPattern(prefix)
	suffix = cleanPattern(suffix)
	local pattern = '^' .. prefix .. '([1-9]%d*)' .. suffix .. '$'

	local nums = {}
	for k, v in pairs(t) do
		if type(k) == 'string' then			
			local num = mw.ustring.match(k, pattern)
			if num then
				nums[#nums + 1] = tonumber(num)
			end
		end
	end
	table.sort(nums)
	return nums
end

--[[
------------------------------------------------------------------------------------
-- numData
--
-- Given a table with keys like ("foo1", "bar1", "foo2", "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.
------------------------------------------------------------------------------------
--]]
function p.numData(t, compress)
	checkType('numData', 1, t, 'table')
	checkType('numData', 2, compress, 'boolean', true)
	local ret = {}
	for k, v in pairs(t) do
		local prefix, num = mw.ustring.match(tostring(k), '^([^0-9]*)([1-9][0-9]*)$')
		if num then
			num = tonumber(num)
			local subtable = ret[num] or {}
			if prefix == '' then
				-- Positional parameters match the blank string; put them at the start of the subtable instead.
				prefix = 1
			end
			subtable[prefix] = v
			ret[num] = subtable
		else
			local subtable = ret.other or {}
			subtable[k] = v
			ret.other = subtable
		end
	end
	if compress then
		local other = ret.other
		ret = p.compressSparseArray(ret)
		ret.other = other
	end
	return ret
end

--[[
------------------------------------------------------------------------------------
-- compressSparseArray
--
-- This takes an array 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.
------------------------------------------------------------------------------------
--]]
function p.compressSparseArray(t)
	checkType('compressSparseArray', 1, t, 'table')
	local ret = {}
	local nums = p.numKeys(t)
	for _, num in ipairs(nums) do
		ret[#ret + 1] = t[num]
	end
	return ret
end

--[[
------------------------------------------------------------------------------------
-- sparseIpairs
--
-- This is an iterator for sparse arrays. It can be used like ipairs, but can
-- handle nil values.
------------------------------------------------------------------------------------
--]]
function p.sparseIpairs(t)
	checkType('sparseIpairs', 1, t, 'table')
	local nums = p.numKeys(t)
	local i = 0
	local lim = #nums
	return function ()
		i = i + 1
		if i <= lim then
			local key = nums[i]
			return key, t[key]
		else
			return nil, nil
		end
	end
end

--[[
------------------------------------------------------------------------------------
-- size
--
-- This returns the size of a key/value pair table. It will also work on arrays,
-- but for arrays it is more efficient to use the # operator.
------------------------------------------------------------------------------------
--]]

function p.size(t)
	checkType('size', 1, t, 'table')
	local i = 0
	for k in pairs(t) do
		i = i + 1
	end
	return i
end


local function defaultKeySort(item1, item2)
	-- "number" < "string", so numbers will be sorted before strings.
	local type1, type2 = type(item1), type(item2)
	if type1 ~= type2 then
		return type1 < type2
	else -- This will fail with table, boolean, function.
		return item1 < item2
	end
end

--[[
	Returns a list of the keys in a table, sorted using either a default
	comparison function or a custom keySort function.
]]
function p.keysToList(t, keySort, checked)
	if not checked then
		checkType('keysToList', 1, t, 'table')
		checkTypeMulti('keysToList', 2, keySort, { 'function', 'boolean', 'nil' })
	end
	
	local list = {}
	local index = 1
	for key, value in pairs(t) do
		list[index] = key
		index = index + 1
	end
	
	if keySort ~= false then
		keySort = type(keySort) == 'function' and keySort or defaultKeySort
		
		table.sort(list, keySort)
	end
	
	return list
end

--[[
	Iterates through a table, with the keys sorted using the keysToList function.
	If there are only numerical keys, sparseIpairs is probably more efficient.
]]
function p.sortedPairs(t, keySort)
	checkType('sortedPairs', 1, t, 'table')
	checkType('sortedPairs', 2, keySort, 'function', true)
	
	local list = p.keysToList(t, keySort, true)
	
	local i = 0
	return function()
		i = i + 1
		local key = list[i]
		if key ~= nil then
			return key, t[key]
		else
			return nil, nil
		end
	end
end

--[[
	Returns true if all keys in the table are consecutive integers starting at 1.
--]]
function p.isArray(t)
	checkType("isArray", 1, t, "table")
	
	local i = 0
	for k, v in pairs(t) do
		i = i + 1
		if t[i] == nil then
			return false
		end
	end
	return true
end

-- { "a", "b", "c" } -> { a = 1, b = 2, c = 3 }
function p.invert(array)
	checkType("invert", 1, array, "table")
	
	local map = {}
	for i, v in ipairs(array) do
		map[v] = i
	end
	
	return map
end

--[[
	{ "a", "b", "c" } -> { ["a"] = true, ["b"] = true, ["c"] = true }
--]]
function p.listToSet(t)
	checkType("listToSet", 1, t, "table")
	
	local set = {}
	for _, item in ipairs(t) do
		set[item] = true
	end
	
	return set
end

--[[
	Recursive deep copy function.
	Preserves identities of subtables.
	
]]
local function _deepCopy(orig, includeMetatable, already_seen)
	-- Stores copies of tables indexed by the original table.
	already_seen = already_seen or {}
	
	local copy = already_seen[orig]
	if copy ~= nil then
		return copy
	end
	
	if type(orig) == 'table' then
		copy = {}
		for orig_key, orig_value in pairs(orig) do
			copy[deepcopy(orig_key, includeMetatable, already_seen)] = deepcopy(orig_value, includeMetatable, already_seen)
		end
		already_seen[orig] = copy
		
		if includeMetatable then
			local mt = getmetatable(orig)
			if mt ~= nil then
				local mt_copy = deepcopy(mt, includeMetatable, already_seen)
				setmetatable(copy, mt_copy)
				already_seen[mt] = mt_copy
			end
		end
	else -- number, string, boolean, etc
		copy = orig
	end
	return copy
end

function p.deepCopy(orig, noMetatable, already_seen)
	checkType("deepCopy", 3, already_seen, "table", true)
	
	return _deepCopy(orig, not noMetatable, already_seen)
end

--[[
	Concatenates all values in the table that are indexed by a number, in order.
	sparseConcat{ a, nil, c, d }  =>  "acd"
	sparseConcat{ nil, b, c, d }  =>  "bcd"
]]
function p.sparseConcat(t, sep, i, j)
	local list = {}
	
	local list_i = 0
	for _, v in p.sparseIpairs(t) do
		list_i = list_i + 1
		list[list_i] = v
	end
	
	return table.concat(list, sep, i, j)
end

--[[
-- This returns the length of a table, or the first integer key n counting from
-- 1 such that t[n + 1] is nil. It is similar to the operator #, but may return
-- a different value when there are gaps in the array portion of the table.
-- Intended to be used on data loaded with mw.loadData. For other tables, use #.
-- Note: #frame.args in frame object always be set to 0, regardless of 
-- the number of unnamed template parameters, so use this function for
-- frame.args.
--]]
function p.length(t)
	local i = 1
	while t[i] ~= nil do
		i = i + 1
	end
	return i - 1
end

function p.inArray(arr, valueToFind)
	checkType("inArray", 1, arr, "table")
	
	-- if valueToFind is nil, error?
	
	for _, v in ipairs(arr) do
		if v == valueToFind then
			return true
		end
	end
	
	return false
end

return p
其他垃圾有什么 血糖高的人应该吃什么食物最好 还愿有什么讲究 谷草转氨酶偏高是什么意思 梦见妈妈出轨预示什么意思
沫字五行属什么 油光满面是什么意思 全友床垫属于什么档次 肝血管瘤挂什么科 爱情和面包是什么意思
什么是cos 喝什么降尿酸 脑癌是什么原因引起的 上海属于什么方向 采字五行属什么
维生素b2有什么功效 83年属什么 仙草是什么草 舌头裂开是什么原因 枕头发黄是什么原因
04年属什么生肖hcv9jop3ns5r.cn 教育局局长是什么级别hcv8jop5ns4r.cn 尿频尿多是什么原因hcv9jop5ns3r.cn 牛蹄筋炖什么好吃hcv8jop2ns7r.cn 查血常规挂什么科hcv7jop7ns4r.cn
发烧喝什么药bjhyzcsm.com 绿松石是什么hcv8jop3ns1r.cn RH什么意思hcv8jop2ns3r.cn 小孩手麻是什么原因hcv9jop2ns9r.cn 绿茶男是什么意思hcv8jop7ns2r.cn
什么矿泉水最贵hcv9jop5ns0r.cn 小米粥配什么菜好吃hcv7jop7ns4r.cn 立羽读什么hkuteam.com 犯六冲是什么意思jiuxinfghf.com 月经期生气会造成什么后果hcv9jop1ns2r.cn
hpv有什么症状吗hcv8jop0ns0r.cn 芒果可以做什么美食cj623037.com 小孩割包皮挂什么科hcv8jop3ns0r.cn 蛇跟什么生肖相冲hcv7jop5ns4r.cn 左膝关节退行性变是什么意思hcv9jop4ns0r.cn
百度