孕妇吃榴莲对胎儿有什么好处| 一号来的月经排卵期是什么时候| 这个梗是什么意思| 多喝水有什么好处| 8月1号是什么星座| 伏是什么意思| 过敏应该挂什么科| 什么门不能开| 指甲竖条纹是什么原因| 乾五行属什么| 四月三日是什么星座| 经常吃莲子有什么好处| 什么药可以缩阴紧致| 高碳钻是什么| 成人礼是什么意思| 水牛背满月脸是什么病| 肠镜检查前需要做什么准备工作| hf医学上是什么意思| 咳嗽痰多吃什么药| 天意不可违是什么意思| 咳嗽有痰吃什么好的快| 3人死亡属于什么事故| 骨折和断了有什么区别| 09年的牛是什么命| 奈何桥是什么意思| 付之一炬什么意思| 醋酸氯已定是什么药| 哮天犬是什么狗| 西米是什么| 专属是什么意思| 胆囊是什么| 月亮为什么会有圆缺变化| 炭疽是什么| 不遗余力的遗是什么意思| 消化道出血有什么症状| 1月3号是什么星座| 宝宝大便发白是什么原因| 平字五行属什么| 索条影是什么意思| 恶露是什么样子的图片| 什么叫腺样体肥大| 付之一炬是什么意思| 白细胞wbc偏高是什么意思| 秘密是什么意思| 电视剧靠什么赚钱| 阴道炎用什么药| 受凉感冒吃什么药| 虱目鱼在大陆叫什么| 黄鼠狼进屋是什么兆头| 胎菊和金银花一起泡水有什么效果| 丧偶是什么意思| 什么是富贵包| 代价什么意思| 激光脱毛有什么副作用| 梦见亲人去世是什么意思| 月经来了同房会导致什么后果| 判官是什么意思| 孙策字什么| 夏天有什么花开| 轻度脂肪肝什么意思| 宫后积液是什么意思| 肉桂茶适合什么人喝| 28岁今年属什么| 雄黄是什么东西| 什么情况下需要做造影| 乳腺结节钙化是什么意思| 富三代是什么意思| 七情六欲指什么| 药引子是什么意思| 冬天有什么水果| 背靠背协议是什么意思| 喉咙痛有什么好办法| 子宫粘连是什么原因造成的| 毁三观是什么意思啊| 史密斯夫妇是什么意思| 计抛是什么意思| 宫腔镜是检查什么的| 十月一日是什么星座| 紫玫瑰代表什么意思| 增加性功能吃什么药| 集训是什么| 护士长是什么级别| 耳朵红热是什么原因| 急性扁桃体发炎吃什么药| 吃什么会引起尿酸高| 天时地利人和什么意思| 献血和献血浆有什么区别| 经常吐是什么原因| 说话不清楚是什么原因导致的| 年轻人白头发是什么原因引起的| 睡觉起来眼睛肿是什么原因| 经常喝饮料有什么危害| 请柬写伉俪什么意思| 人生百味下一句是什么| nba新赛季什么时候开始| 喝碱性水有什么好处| 感觉是什么意思| 甲状腺有血流信号是什么意思| 刮痧红色说明什么原因| 兔子不吃窝边草是什么生肖| 男女双修是什么意思| 什么是走读生| 厚实是什么意思| 1985年属什么| 玉米淀粉能做什么美食| 男属兔和什么属相最配| 脖子痛是什么原因| 糖尿病病人吃什么水果| 霉菌是什么| 吉士粉是什么东西| 骨骼肌率是什么意思| 三点水一个兆读什么| 什么能美白皮肤而且效果快| 尿检红细胞高是什么原因| 尿酸高平时要注意什么| 杜仲有什么功效| 耐药性什么意思| 仓鼠用什么洗澡| 高血压高血脂不能吃什么| 玉溪烟属于什么档次| 十一月九号是什么星座| 棕色和什么颜色搭配好看| 96120是什么电话| gold什么意思| 封建迷信是什么| 煽是什么意思| 打开心扉是什么意思| 吃什么水果降火| 梅毒螺旋体抗体阴性是什么意思| 精神病吃什么药| 什么伤口需要打破伤风| 送护士女朋友什么礼物| 下海的意思是什么| 蚊香灰有什么作用| 卒中患者什么意思| 汉字最多笔画是什么字| 什么是感觉| 玺是什么意思| 蓝风铃香水什么味道| 输卵管堵塞是什么原因| 牙疼吃什么好得快| 什么油炒菜好吃| 小龙虾吃什么食物| 名声大噪是什么意思| 散漫是什么意思| 剪什么样的发型好看| hpv52阳性是什么意思| 途径是什么意思| 什么颜色对眼睛有好处| 女士内裤用什么洗最好| 肠道有息肉有什么症状| squirrel是什么意思| 旅拍什么意思| 尿频尿急尿痛吃什么药| 镰刀菌用什么杀菌剂| 什么病不能吃鲤鱼| dha是什么意思| 偈语是什么意思| 男人尿频是什么原因| 28.88红包代表什么意思| 吃什么药能推迟月经| 胸闷是什么感觉| 闰6月有什么说法| ast是什么| 七月七日是什么生肖| 甙是什么意思| 灰色配什么颜色好看| 4.28是什么星座| 单绒双羊是什么意思| 痱子涂什么药膏好| 血脂高什么意思| 收口是什么意思| 验孕棒什么时候测比较准| 70年属狗的是什么命| 为什么会长水泡| 脑梗用什么药| 抽烟肺疼是什么原因| 川字五行属什么| 麒字五行属什么| 睑缘炎用什么药| 上海的市花是什么花| 郑和下西洋是什么朝代| cvt是什么意思| 糖尿病2型是什么意思| 粉尘螨是什么东西| 梅毒检查挂什么科| 角质增生是什么意思| hbsag阳性是什么意思| 珞字五行属什么| wendy什么意思| 双子男喜欢什么样的女生| 什么时候抓知了猴| 面基是什么意思啊| 第一次见女方家长带什么礼物好| joeone是什么牌子| rbp是什么意思| 什么是普拉提| 被动什么意思| 暂住证和居住证有什么区别| 粘人是什么意思| 皮下脂肪瘤挂什么科| 牛鞭是牛的什么部位| titus手表属于什么档次| 什么叫钙化| 扁桃体切除对身体有什么影响| 风团是什么原因引起的| 大舌头是什么意思| 背沟深代表什么| 磨牙是什么原因| 凤雏是什么意思| 颈部多发淋巴结是什么意思| 十月十号是什么星座| 炙的意思是什么| 神经疼痛吃什么药| 茯苓和土茯苓有什么区别| 爱恨情仇是什么意思| 过敏忌口不能吃什么| 鸽子怕什么怎么赶走| 孩子不好好吃饭是什么原因| 日加一笔变成什么字| 氟哌酸是什么药| 低烧是什么病的前兆| 变质是什么意思| 什么是凌汛| 意难平是什么意思| 间质性肺炎是什么意思| 喆是什么意思| 红细胞体积偏高是什么意思| 梦见老公不理我是什么意思| 公开遴选公务员是什么意思| 车震什么意思| 人生苦短是什么意思| 拍手腕中间有什么好处| 酸菜鱼一般加什么配菜| 酸梅汤有什么功效| 肝血虚吃什么药| 有机蔬菜是什么意思| 抖是什么生肖| 尊敬是什么意思| 道谢是什么意思| 穷凶极恶是什么生肖| 公务员是干什么的| 孩子脾虚内热大便干吃什么药| 静养是什么意思| 补气血吃什么水果| 胆囊壁毛糙吃什么药效果好| 五个月宝宝可以吃什么水果| 犯贱是什么意思| 一个鸟一个木念什么| 麦芯粉是什么面粉| 宫颈ecc是什么意思| 四月是什么生肖| 肾和性功能有什么关系| 三个吉念什么| 脸一边大一边小是什么原因| 盆浴是什么意思| 炖羊肉都放什么调料| 破涕为笑什么意思| dm代表什么| 滴水不漏是什么生肖| 胆囊是干什么用的| 芭乐是什么季节的水果| 宫颈癌吃什么好| 肠道有息肉有什么症状| 百度Zum Inhalt springen

一艘载百余人轮渡在韩国西南海域触礁

Vun Wikipedia
百度 这次大会回顾和总结党的十八大以来党和国家事业的历史性变革和历史性成就,作出中国特色社会主义进入了新时代、我国社会主要矛盾发生转化等重大政治判断,深刻阐述新时代中国共产党的历史使命,确定新时代的奋斗目标和战略安排,对新时代推进中国特色社会主义伟大事业和党的建设新的伟大工程作出全面部署。

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
肾病吃什么药最好 为什么吃西瓜会拉肚子 梦到蛇预示着什么 为什么超市大米不生虫 医生说忌生冷是指什么
烂大街是什么意思 破伤风是什么 儿童便秘吃什么最快排便 推手是什么意思 狗喜欢吃什么食物
名人轶事是什么意思 有时候会感到莫名的难过是什么歌 一喝酒就脸红是什么原因 籽字五行属什么 乙肝两对半25阳性是什么意思
肛门出血用什么药 女性胆囊炎有什么症状 江西古代叫什么 第四个手指叫什么 无舌苔是什么原因
可可是什么饮料hcv8jop5ns8r.cn 水瓶座是什么象hcv9jop5ns2r.cn 牙齿黄用什么牙膏hcv9jop1ns4r.cn 北京摇号什么时候开始的hcv8jop5ns8r.cn 睁一只眼闭一只眼是什么意思hcv8jop4ns6r.cn
不典型血管瘤什么意思hcv9jop5ns0r.cn 唾液酸苷酶阳性什么意思hcv8jop7ns5r.cn 姑姑的孩子叫什么bfb118.com charcoal是什么颜色hcv9jop2ns4r.cn 咳嗽吃什么药ff14chat.com
中医经方是什么意思hcv7jop9ns8r.cn 今年养殖什么最挣钱hcv8jop4ns7r.cn 锦衣玉食什么意思hcv9jop3ns5r.cn 高血压的人不能吃什么hcv8jop9ns6r.cn 什么时候看到的月亮最大hcv9jop3ns4r.cn
一什么明月hcv8jop1ns1r.cn 肠系膜淋巴结炎吃什么药最有效0297y7.com 五行缺什么hcv9jop5ns5r.cn 倒打一耙的前一句是什么shenchushe.com 什么的枝干hcv8jop4ns4r.cn
百度