面子是什么意思| 蜂蜜的波美度是什么意思| 绿茶妹是什么意思| 一般什么人戴江诗丹顿| 梦见捡板栗是什么意思| 冰片是什么| 小壁虎的尾巴有什么作用| 溶媒是什么| 什么吃蚊子| 总感觉饿是什么原因| 四叶草代表什么意思| 姓杨的女孩子取什么名字| 构筑物是什么意思| 天上的月亮是什么生肖| 胃气胃胀吃什么药最好| 支气管舒张试验阳性是什么意思| 身份证是什么字体| 比目鱼长什么样| 吐槽什么意思| 面红耳赤是什么意思| 的五行属什么| anti是什么意思| 咕咕咕咕叫是什么鸟| 浙江有什么旅游景点| 虾和什么相克| 沧州有什么好玩的地方| 梦见摘水果是什么意思| 不忘初心方得始终是什么意思| 朱字五行属什么| 什么东西进去是硬的出来是软的| 孕妇子痫是什么病| 什么生日的人有佛缘| 2035年属什么生肖| 病人出院送什么花| 什么人容易得尿毒症| 贾宝玉大名叫什么| 脖子下面的骨头叫什么| 朝花夕拾什么意思| 芽孢是什么| 喝什么茶清肺效果最好| 糖耐量是什么| 什么地问填词语| 任督二脉是什么意思| 腊月初六是什么星座| 晚上睡觉小腿抽筋是什么原因| 帆船像什么| 吃饭的时候恶心想吐是什么原因| 心肌梗塞有什么症状| aso是什么意思| 什么的孙悟空| 数是什么意思| 梦见打死蛇是什么预兆| 垂体催乳素高是什么原因| 笑口常开是什么生肖| 河南话信球是什么意思| 吉吉念什么| 腹泻肚子疼吃什么药| 亚健康是什么意思| 热射病是什么症状| 空腹血糖17已经严重到什么时候| 金字旁土念什么字| 1980属什么生肖| 阴唇肿是什么原因| 胸闷是什么原因引起的| 有什么黄色网站| 尿蛋白三个加号吃什么药| 鼻子旁边长痘是什么原因| 五指毛桃煲汤配什么| 更年期潮热出汗吃什么药| 结缡什么意思| 理疗和按摩有什么区别| 开悟是什么意思| 身经百战是什么意思| 杏仁有什么功效| 射手座和什么座最配对| 幽门螺旋杆菌弱阳性是什么意思| 补肾壮阳吃什么好| 金什么| 神经痛什么原因引起的| 文才是什么意思| 阴茎疼是什么原因| 什么是接触性皮炎| 女人小便出血是什么原因| 天枢是什么意思| c表示什么| 糊精是什么东西| 痣发痒是什么原因| 白细胞多是什么原因| 肃穆是什么意思| 梦见被熊追是什么意思| 健康证需要检查什么| 三点水弘读什么| 淋巴组织增生是什么意思| 过问是什么意思| 大姨妈来吃什么好| 失眠多梦吃什么药| 韬光养晦下一句是什么| 什么样的梦才算是胎梦| 甲状腺1度肿大是什么意思| 什么叫糖类抗原| 嗜酸性粒细胞高是什么原因| 红细胞高什么原因| 卓玛什么意思| 纠葛是什么意思| 胸膜牵拉是什么意思| 女人小便疼是什么原因| 你要做什么| 529是什么意思| 导管子是什么意思| 抽水是什么意思| 小螃蟹吃什么| 4月3号什么星座| 血压什么时候最高| 小满是什么季节| 女人长胡子是什么原因| 花是植物的什么器官| 59岁生日有什么讲究| venes保温杯是什么品牌| 柠檬泡水喝有什么好处| 脖子皮肤黑是什么原因| 驿是什么意思| 瞌睡多是什么原因| 月与什么有关| 送病人什么礼物好| 打嗝吃什么药| 葡萄糖酸钙锌口服溶液什么时候喝| 脂肪疝是什么病| 办身份证要穿什么衣服| 蚂蚁上树什么姿势| 水逆退散什么意思| 熔炉是什么意思| 左眼屈光不正是什么意思| 经常手淫会有什么危害| 蚊子的天敌是什么| 榔头是什么意思| 自律是什么意思| 梦到一个人意味着什么| 左上眼皮跳是什么预兆| 宠物蛇吃什么食物| 规格是什么| 耘是什么意思| 反应蛋白高是什么意思| 阴道壁是什么样的| 格局什么意思| 烂好人什么意思| 慢性胃炎是什么原因引起的| 补办医保卡去什么地方| 痱子用什么药膏最有效| 结缔组织是什么| 力所能及什么意思| 家有喜事指什么生肖| 艾滋病通过什么传播| 正餐是什么意思| 阿迪达斯和三叶草有什么区别| 颤抖是什么意思| chloe是什么意思| 尿毒症什么症状| mf是什么| boy是什么牌子| 千人千面是什么意思| 狮子是什么科| 什么地哭| 讳莫如深是什么意思| 岳字五行属什么| 猫的五行属什么| 梦见房子是什么意思| 尿酸高是什么引起的| 5月5号什么星座| 周瑜是什么样的人| 头发有什么用处| 彪是什么动物| 可谓是什么意思| 七五年属什么| 休克是什么| 乙肝核心抗体阳性说明什么| 梦见豹子是什么预兆| 托马斯是什么意思| 什么鱼没刺| 你喜欢我什么| 孕妇生气对胎儿有什么影响| 什么光什么色| 烂嘴是什么原因| 预谋什么意思| bb是什么意思| 城隍是什么意思| 肾结石可以喝什么饮料| 众什么意思| 过肺是什么意思| 7月18日什么星座| 验光pd是什么意思| 什么季节减肥效果最快最好| 单亲家庭是指什么| 良缘是什么意思| 己巳是什么意思| 更年期提前是什么症状| 手脚脱皮是什么原因导致的| 诺贝尔奖是什么意思| 抑郁吃什么药| 为什么胃酸会分泌过多| 什么是普世价值| 增强免疫力吃什么药| tissot是什么牌子1853| 眼睛发炎吃什么消炎药| 脸色发黑是什么原因| 风雨雷电代表什么生肖| 狐臭是什么原因| 故的偏旁是什么| xxoo是什么意思| 怀孕什么时候能测出来| 白带有血是什么原因| 38度吃什么药| 男人割了皮包什么样子| 为什么医生都穿洞洞鞋| 腰椎钙化是什么意思| 电风扇什么牌子质量好| 阴道内痒是什么原因| 监制是干什么的| 月经来一点又不来了是什么原因| 广东有什么城市| 晚上很难入睡是什么原因| 浮躁的意思是什么| 南通在江苏什么位置| 梦见白萝卜是什么意思| 尿黄起泡是什么原因| 火红火红的什么| 梦见桥塌了有什么预兆| 消防支队长是什么级别| 朱砂有什么功效| 抽筋是什么原因引起的| 墨绿色大便是什么原因| 尿hcg阳性是什么意思| 大拇指脱皮是什么原因| 4.7号是什么星座| 上午十点是什么时辰| 小腿浮肿吃什么药| 扫把星代表什么生肖| 女人什么时候最想男人| 什么是狐臭| 12月29号是什么星座| 希爱力是什么药| 三月18号是什么星座的| 12月是什么座| 晕轮效应是什么意思| 丝瓜长什么样| 养胃吃什么最好| 臁疮是什么病| 治未病科是看什么病的| 肠梗阻是什么意思| 异常子宫出血是什么原因| 五月有什么节日| 鹦鹉为什么会说话| 肿瘤标志物是什么意思| 民考民是什么意思| 手蜕皮什么原因| 彩超无回声是什么意思| 三维彩超和四维彩超有什么区别| 半夜醒来睡不着是什么原因| 宫腔镜是什么| 传媒公司是干什么的| 精气是什么意思| 甲状腺彩超能查出什么| 斜纹棉是什么面料| 什么饮料解渴| 中性人是什么意思| 百度Перайсц? да зместу

粤媒:足球属于少数人 校园体育最需教体协同

З В?к?педы?, свабоднай энцыклапеды?
百度 四是突出安全生产。

Дакументацыю да гэтага модуля можна стварыць у Модуль:TableTools/Дакументацыя

------------------------------------------------------------------------------------
--                                   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)
	return type(v) == 'number' and v >= 1 and floor(v) == v and v < infinity
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)
	return type(v) == 'number' and v ~= v
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)
	checkType('shallowClone', 1, t, 'table')
	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(arr)
	checkType('removeDuplicates', 1, arr, 'table')
	local isNan = p.isNan
	local ret, exists = {}, {}
	for _, v in ipairs(arr) 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
		elseif not exists[v] then
			ret[#ret + 1] = v
			exists[v] = true
		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 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.
		return s:gsub('([%(%)%%%.%[%]%*%+%-%?%^%$])', '%%%1')
	end

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

	local nums = {}
	for k 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 _ 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
	elseif type1 == 'table' or type1 == 'boolean' or type1 == 'function' then
		return tostring(item1) < tostring(item2)
	else
		return item1 < item2
	end
end
------------------------------------------------------------------------------------
-- keysToList
--
-- Returns an array 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 arr = {}
	local index = 1
	for k in pairs(t) do
		arr[index] = k
		index = index + 1
	end

	if keySort ~= false then
		keySort = type(keySort) == 'function' and keySort or defaultKeySort
		table.sort(arr, keySort)
	end

	return arr
end

------------------------------------------------------------------------------------
-- sortedPairs
--
-- 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 arr = p.keysToList(t, keySort, true)

	local i = 0
	return function ()
		i = i + 1
		local key = arr[i]
		if key ~= nil then
			return key, t[key]
		else
			return nil, nil
		end
	end
end

------------------------------------------------------------------------------------
-- isArray
--
-- Returns true if the given value is a table and all keys are consecutive
-- integers starting at 1.
------------------------------------------------------------------------------------
function p.isArray(v)
	if type(v) ~= 'table' then
		return false
	end
	local i = 0
	for _ in pairs(v) do
		i = i + 1
		if v[i] == nil then
			return false
		end
	end
	return true
end

------------------------------------------------------------------------------------
-- isArrayLike
--
-- Returns true if the given value is iterable and all keys are consecutive
-- integers starting at 1.
------------------------------------------------------------------------------------
function p.isArrayLike(v)
	if not pcall(pairs, v) then
		return false
	end
	local i = 0
	for _ in pairs(v) do
		i = i + 1
		if v[i] == nil then
			return false
		end
	end
	return true
end

------------------------------------------------------------------------------------
-- invert
--
-- Transposes the keys and values in an array. For example, {"a", "b", "c"} ->
-- {a = 1, b = 2, c = 3}. Duplicates are not supported (result values refer to
-- the index of the last duplicate) and NaN values are ignored.
------------------------------------------------------------------------------------
function p.invert(arr)
	checkType("invert", 1, arr, "table")
	local isNan = p.isNan
	local map = {}
	for i, v in ipairs(arr) do
		if not isNan(v) then
			map[v] = i
		end
	end

	return map
end

------------------------------------------------------------------------------------
-- listToSet
--
-- Creates a set from the array part of the table. Indexing the set by any of the
-- values of the array returns true. For example, {"a", "b", "c"} ->
-- {a = true, b = true, c = true}. NaN values are ignored as Lua considers them
-- never equal to any value (including other NaNs or even themselves).
------------------------------------------------------------------------------------
function p.listToSet(arr)
	checkType("listToSet", 1, arr, "table")
	local isNan = p.isNan
	local set = {}
	for _, v in ipairs(arr) do
		if not isNan(v) then
			set[v] = true
		end
	end

	return set
end

------------------------------------------------------------------------------------
-- deepCopy
--
-- Recursive deep copy function. Preserves identities of subtables.
------------------------------------------------------------------------------------
local function _deepCopy(orig, includeMetatable, already_seen)
	if type(orig) ~= "table" then
		return orig
	end
	
	-- already_seen stores copies of tables indexed by the original table.
	local copy = already_seen[orig]
	if copy ~= nil then
		return copy
	end
	
	copy = {}
	already_seen[orig] = copy -- memoize before any recursion, to avoid infinite loops
	
	for orig_key, orig_value in pairs(orig) do
		copy[_deepCopy(orig_key, includeMetatable, already_seen)] = _deepCopy(orig_value, includeMetatable, already_seen)
	end
	
	if includeMetatable then
		local mt = getmetatable(orig)
		if mt ~= nil then
			setmetatable(copy, _deepCopy(mt, true, already_seen))
		end
	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 or {})
end

------------------------------------------------------------------------------------
-- sparseConcat
--
-- 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 arr = {}

	local arr_i = 0
	for _, v in p.sparseIpairs(t) do
		arr_i = arr_i + 1
		arr[arr_i] = v
	end

	return table.concat(arr, sep, i, j)
end

------------------------------------------------------------------------------------
-- length
--
-- Finds the length of an array, or of a quasi-array with keys such as "data1",
-- "data2", etc., using an exponential search algorithm. 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, prefix)
	-- requiring module inline so that [[Module:Exponential search]] which is
	-- only needed by this one function doesn't get millions of transclusions
	local expSearch = require("Module:Exponential search")
	checkType('length', 1, t, 'table')
	checkType('length', 2, prefix, 'string', true)
	return expSearch(function (i)
		local key
		if prefix then
			key = prefix .. tostring(i)
		else
			key = i
		end
		return t[key] ~= nil
	end) or 0
end

------------------------------------------------------------------------------------
-- inArray
--
-- Returns true if searchElement is a member of the array, and false otherwise.
-- Equivalent to JavaScript array.includes(searchElement) or
-- array.includes(searchElement, fromIndex), except fromIndex is 1 indexed
------------------------------------------------------------------------------------
function p.inArray(array, searchElement, fromIndex)
	checkType("inArray", 1, array, "table")
	-- if searchElement is nil, error?

	fromIndex = tonumber(fromIndex)
	if fromIndex then
		if (fromIndex < 0) then
			fromIndex = #array + fromIndex + 1
		end
		if fromIndex < 1 then fromIndex = 1 end
		for _, v in ipairs({unpack(array, fromIndex)}) do
			if v == searchElement then
				return true
			end
		end
	else
		for _, v in pairs(array) do
			if v == searchElement then
				return true
			end
		end
	end
	return false
end

------------------------------------------------------------------------------------
-- merge
--
-- Given the arrays, returns an array containing the elements of each input array
-- in sequence.
------------------------------------------------------------------------------------
function p.merge(...)
	local arrays = {...}
	local ret = {}
	for i, arr in ipairs(arrays) do
		checkType('merge', i, arr, 'table')
		for _, v in ipairs(arr) do
			ret[#ret + 1] = v
		end
	end
	return ret
end

------------------------------------------------------------------------------------
-- extend
--
-- Extends the first array in place by appending all elements from the second
-- array.
------------------------------------------------------------------------------------
function p.extend(arr1, arr2)
	checkType('extend', 1, arr1, 'table')
	checkType('extend', 2, arr2, 'table')

	for _, v in ipairs(arr2) do
		arr1[#arr1 + 1] = v
	end
end

return p
榕字五行属什么 厅级干部是什么级别 子宫肌层回声欠均匀是什么意思 一切唯心造是什么意思 身上痒但是什么都没有
痛风吃什么药最好 额头上长斑是什么原因造成的 益禾堂什么好喝 aug是什么意思 吃甲硝唑有什么副作用
小蛮腰是什么意思 喝水就打嗝是什么原因 带下病是什么病 ecc是检查什么的 清补凉是什么
粽子的叶子是什么叶 天癸是什么意思 油腔滑调指什么生肖 鹅肉炖什么好吃又营养 columbia是什么牌子
心阳不足吃什么中成药hcv8jop5ns6r.cn 田亮为什么不娶郭晶晶hcv9jop3ns5r.cn 故友是什么意思hcv9jop1ns3r.cn 心脏病有什么症状hcv7jop9ns7r.cn 慢性咽炎有什么症状hcv8jop1ns2r.cn
喝酒有什么好处wuhaiwuya.com 月黑风高什么意思hcv7jop4ns7r.cn 桜什么意思hcv9jop5ns4r.cn 什么之交hcv9jop3ns5r.cn 属鸡的是什么命hcv8jop7ns0r.cn
月色真美是什么意思bysq.com 竹节棉是什么面料hcv8jop0ns0r.cn 什么是穿堂风hcv9jop0ns5r.cn 戒断是什么意思hcv8jop9ns0r.cn 烟火气息是什么意思hcv8jop2ns1r.cn
小孩手上脱皮是什么原因hcv7jop9ns5r.cn 受虐倾向是什么sanhestory.com 项羽是什么生肖hcv9jop8ns2r.cn 胆固醇高是什么意思hcv8jop3ns5r.cn 患得患失是什么意思hcv7jop4ns6r.cn
百度