卫生院院长是什么级别| 老鼠和什么属相相冲| 骨肉瘤是什么病| 兔死什么悲| 十月十一日是什么星座| 高是什么意思| 心魔是什么意思| 结果是什么意思| 减脂是什么意思| 遗精是什么| 县局长是什么级别| 矿油是什么| 备孕怀男孩做什么准备| 圆脸适合什么镜框| 菠菜什么时候种最合适| 硬不起来是什么原因| 什么是社恐| 项羽姓什么| 蟹柳是什么做的| 89年什么命| 1978年属马五行缺什么| 减肥吃什么水果| 手书是什么意思| 满江红属于什么植物| 教师节属什么生肖| lee是什么牌子| 嗅觉失灵是什么原因| 介质是什么| 双侧腋窝淋巴结可见什么意思| 关东煮是什么| 1月5号什么星座| 什么叫留守儿童| 打嗝吃什么药好| 为什么高铁没有e座| 什么茶叶好喝又香又甜| 本能是什么意思| 乙肝两对半25阳性是什么意思| 龟苓膏是什么做的| 富强粉是什么面粉| 后嗣是什么意思| 2016年是什么生肖| 先父遗传是什么意思| 什么动物最安静| 瘘管是什么病| 什么是动态心电图| 什么是肺部磨玻璃结节| 婀娜多姿是什么意思| 大象的天敌是什么动物| 表哥的女儿叫什么| 口腔溃疡为什么是白色的| 木隶念什么| 囧途什么意思| 粉丝是什么做的| 兹禧属什么生肖| 天冬是什么| 浙江大学校长什么级别| 金银花有什么功效和作用| 梦见小黑蛇是什么预兆| 丝状疣用什么药膏最好| 总胆固醇高是什么原因| 9.4号是什么星座| 良代表什么生肖| 全套是什么| 尺码m是什么意思| 腋下出汗有异味是什么原因| 嘴紫是什么原因| prp治疗是什么意思| 什么是黄体期| 相亲是什么意思| 贡中毒有什么症状| 咽痛吃什么药| 川崎病是什么原因引起的| 为什么空腹血糖比餐后血糖高| 数字5代表什么意思| 婴儿第一次理发有什么讲究吗| 胸透主要检查什么| 吃什么东西补血最快| 幽门螺旋杆菌有什么危害| 金银花泡水喝有什么好处| circle什么意思| 区级以上医院是什么意思| 孙策和孙权什么关系| 附耳是什么意思| 1957年属什么| 女人颧骨高有什么说法| 吃什么治便秘最有效| 芦荟有什么作用| oo什么意思| 7点到9点是什么时辰| hcg高代表什么| fdg是什么意思| 蚊子除了吸血还吃什么| 出尔反尔是什么意思| 喝什么可以美白| 三个又是什么字| 爱哭的人是什么性格| 有氧运动是什么| 看甲状腺挂什么科| 什么是丛林法则| 什么是碳足迹| 百香果不能和什么一起吃| 什么是碱性水果| 缺钾是什么病| 为什么我不快乐| 皮肤属于什么组织| 属鸡的和什么属相最配| 学长是什么意思| 清肺火肺热吃什么药最有效| 蜡笔小新的爸爸叫什么| 梦见穿破鞋是什么意思| 指甲上有竖条纹是什么原因| 古代人用什么刷牙| 为什么小腿会抽筋| 红隼吃什么| 减肥吃什么药| 尿淀粉酶高是什么原因| 七月十六是什么日子| 急性前列腺炎吃什么药| 睡觉被口水呛醒是什么原因| 腊肉炒什么菜好吃| 嘴里甜是什么原因| 猫为什么要绝育| ad什么时候吃最好| 为什么乳头内陷| 潮汐是什么意思| 水变成冰为什么体积变大| 什么叫非甾体抗炎药| 回肠荡气什么意思| 格桑花是什么意思| 韭菜不能和什么一起吃| 轮回是什么意思| 月是什么结构| 浑身疼痛什么原因| 脚趾头麻木是什么原因| 红皮鸡蛋和白皮鸡蛋有什么区别| 公章是什么样的| 无大碍是什么意思| edm是什么意思| 心房纤颤是什么意思| kap是什么意思| 什么是腰间盘突出| 9月份出生的是什么星座| 生辰八字五行缺什么| 什么人容易高原反应| 黑色是什么颜色组成的| 治妇科炎症用什么药好| 白舌苔是什么原因| evisu是什么牌子中文| 左顾右盼的顾是什么意思| 少尉军衔是什么级别| 尿酸碱度是什么意思| 璟字五行属什么| 耳朵会动的人说明什么| 感觉是什么意思| 平安果什么时候吃| 姜汁可乐有什么功效与作用| 眼睛模糊是什么原因| 公顷是什么意思| 婴儿补钙什么牌子的好| 咖色配什么颜色好看| 颜控什么意思| 月经血块多是什么原因| 观音成道日是什么意思| 抗原体阳性是什么意思| 二米饭是什么| 罄竹难书什么意思| 黄金芽是什么茶| 月经期间能吃什么水果| 右手无名指戴戒指是什么意思| 基友是什么关系| 逆商是什么意思| 董监高是什么意思| mmol是什么单位| 女人梦见大蟒蛇是什么征兆| 梦见偷鸡是什么预兆| 指甲盖上有竖纹是什么原因| 住房公积金缴存基数是什么意思| 卫字五行属什么| 蝉喜欢吃什么| 9.22是什么星座| 什么食物补锌| 唐氏综合征是什么意思| 移车打什么电话| 保鲜卡是什么原理纸片| o型阴性血是什么意思| 中午吃什么| 手指关节疼痛吃什么药| 日照香炉生紫烟的香炉是什么意思| 宬字五行属什么| 处心积虑什么意思| 什么然起什么| 口腔溃疡补充什么维生素| 教师编制是什么意思| 十一月十七日是什么星座| 胃动力不足是什么原因造成的| 男性尿路感染有什么症状| 肚脐周围疼是什么原因| 开金花是什么生肖| 甲状腺低回声什么意思| 阴毛长虱子用什么药| 膝关节疼痛用什么药效果最好| 范思哲是什么品牌| 为什么早上起来恶心想吐| 鳞状上皮增生什么意思| 息风止痉是什么意思| 什么人不适合做厨师| 什么牌子冰箱好| 肺主皮毛是什么意思| 唐老鸭叫什么名字| 什么是射精| 眼干眼涩用什么眼药水| 过生日吃什么| 度蜜月什么意思| 梦见杀蛇是什么意思| 婴儿足底血筛查什么| 经常生病是什么原因| 一个立一个羽念什么| 海笋是什么东西| lagogo是什么牌子| 得宫颈癌的前兆是什么| 浮肿吃什么药| 栋梁之材是什么意思| tory burch什么牌子| 小孩病毒性感冒吃什么药效果好| 醛固酮高吃什么降压药| 梦见小男孩拉屎是什么意思| 农业户口和居民户口有什么区别| 球镜柱镜是什么意思| 大骨节病是一种什么病| 埋伏牙是什么意思| 碳酸氢钠俗称什么| 胰腺炎恢复期吃什么好| 包茎不割会有什么影响| 蟑螂喜欢什么样的环境| 小孩抵抗力差吃什么提高免疫力| 金字旁目字读什么| 单活胎是什么意思| 拔萝卜什么意思| 尿蛋白质阳性是什么意思| 吃了榴莲不可以吃什么| 取环后要注意什么事项| 吃维生素b2有什么好处和副作用| 电动伐木锯什么牌子好| 11月15日什么星座| 四大美女指什么生肖| 做梦梦到大蟒蛇是什么意思| 二级产前超声检查是什么| 肛门瘙痒看什么科| 竹子可以做什么| 松果体囊肿是什么病| 甲状腺功能三项查什么| 左眼跳什么预兆| 武则天是什么朝代| 羊肚菌为什么那么贵| 理疗是什么| 拔罐起水泡是什么原因| 尿频是什么原因造成的| 被蜈蚣咬了有什么症状| 马天宇是什么民族| p.a.是什么意思| 口腔溃疡吃什么好的快| 同房后小腹痛什么原因| 豚鼠吃什么食物| 钙化点是什么意思| 百度Zum Inhalt springen

澳大利亚的国宝是什么

aus Wikipedia, der freien Enzyklop?die
百度 医生对乐乐的诊断结果为有重度抑郁症状。

Die Dokumentation für dieses Modul kann unter Modul:TableTools/Doku erstellt werden

--[[
------------------------------------------------------------------------------------
--                               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
pr是什么意思医学 香赞是什么意思 夜间睡觉口干口苦是什么原因 氧化铜什么颜色 六月九号什么星座
心机重的人弱点是什么 幼犬吃什么 菱形脸适合什么发型 做可乐鸡翅用什么可乐 什么东西能去脸上的斑
七月一是什么星座 oem是什么 大姨妈黑色是什么原因 小儿舌苔白厚什么原因 孕晚期为什么会脚肿
五海瘿瘤丸主要治什么病 呈现是什么意思 宜破屋是什么意思 sos代表什么 佛系是什么意思啊
去除扁平疣用什么药膏hcv8jop9ns9r.cn 血糖高可以喝什么饮料hcv9jop1ns0r.cn 脚底长鸡眼是什么原因bysq.com 什么是内卷hcv8jop7ns8r.cn 橘子什么季节成熟hcv9jop0ns9r.cn
小根蒜学名叫什么hcv8jop9ns1r.cn 激素六项什么时间查最好hcv9jop0ns4r.cn 痛风都不能吃什么东西hcv8jop8ns2r.cn 血糖高吃什么降血糖hcv9jop3ns5r.cn 这是什么字hcv8jop1ns7r.cn
朗朗原名叫什么hcv8jop7ns8r.cn 止步不前什么意思kuyehao.com 什么症状要查心肌酶dajiketang.com 压差小是什么原因引起的hcv9jop4ns7r.cn 干预是什么意思hcv8jop5ns1r.cn
小孩出汗多是什么原因gysmod.com 女性尿道出血是什么原因引起的hcv8jop0ns6r.cn 台风什么时候到福建hcv9jop7ns5r.cn 家有蝙蝠是什么兆头0735v.com 福州有什么好玩的地方hcv9jop6ns7r.cn
百度