o型血父母是什么血型| 心包积液吃什么药| 心慌什么感觉| 什么情况啊这是| 安五行属什么| 今天是美国什么节日| 孕妇做糖筛是检查什么| 为什么突然头晕| gag是什么意思| dw手表属于什么档次| ev病毒是什么| 常吃阿司匹林有什么副作用| 玉髓什么颜色最贵| 苹果醋什么时候喝最好| 关节疼挂什么科| 农历五月初五是什么星座| 尿潜血十一是什么意思| 肠胃炎可以吃什么水果| 肠腔积气是什么原因| 冠脉cta是什么检查| 舌苔发白是什么原因呢| 头孢长什么样图片| 安抚奶嘴什么时候开始用| air是什么牌子| police是什么意思| 海棠花的花语是什么| 青海湖里面有什么鱼| 降钙素原高是什么原因| 15天来一次月经是什么原因| 过敏不能吃什么东西| 减肥期间吃什么主食| 女命正财代表什么| 眼睛干涩模糊用什么眼药水| kkp什么意思| 单抗主要治疗什么| 盲从什么意思| 为什么坐久了屁股疼| 心有余悸是什么意思| 哮喘吃什么药最有效| 复合是什么意思| 皮肤一碰就红是什么原因| 什么对眼睛好| 才貌双全是什么生肖| 嗓子发炎是什么原因引起的| 红得什么| 女人白带多是什么原因| 孕妇喝什么牛奶好| 玉米须有什么功效| 脚真菌感染用什么药最好| 什么食物容易消化| 1996年属什么生肖| 100元人民币什么时候发行的| t1w1高信号代表什么| 脾胃不好吃什么食物| 检查脑袋应该挂什么科| 孕妇血糖高吃什么| 舞象之年是什么意思| 吃什么补胶原蛋白| 舌头紫色是什么原因| 庶子是什么意思| 酮症酸中毒什么原因引起的| 牛仔布料是什么面料| 虎皮兰开花寓意什么| 王晶老婆叫什么名字| http什么意思| 人为什么会生病| 攥是什么意思| 宫腔镜手术是什么手术| 姐姐的女儿叫什么| g代表什么单位| 什么时候立夏| 双恋是什么意思| rmssd是什么意思| 骨科是什么意思| 蒙脱石是什么| 交警大队长是什么级别| 木耳炒什么好吃| 什么是阴茎| 血小板偏高是什么原因| 3.25是什么星座| 淋巴结用什么药效果好| 王母娘娘姓什么| 脑白质病变是什么意思| 阳虚吃什么调理| 女人太瘦吃什么增肥| 中性粒细胞低说明什么| 送护士女朋友什么礼物| opple是什么牌子| 楔形是什么形状图片| 平舌音是什么| 嘛呢是什么意思| loser是什么意思| 空气棉是什么面料| 花椒泡脚有什么好处| 盆腔炎用什么药效果好| 脊髓空洞是什么意思| 皮肤黑穿什么颜色的衣服好看| alk是什么意思| 急性肠胃炎吃什么| 人乳头瘤病毒阴性是什么意思| 好机车是什么意思| 肾病钾高吃什么食物好| 皮蛋为什么含铅| 什么是筋膜炎| 当兵什么时候入伍| 奢华是什么意思| 双侧胸膜增厚是什么意思| 毛泽东是什么样的人| 九月23日是什么星座| 买车置换是什么意思| 处男是什么意思| 湖南简称什么| 中国移动增值业务费是什么| 辄的意思是什么| 餐饮行业五行属什么| 尿不干净有余尿是什么原因| 宫寒是什么原因引起的| 罄竹难书的罄什么意思| 甲钴胺片治疗什么病| 塞浦路斯说什么语言| 老年人吃什么奶粉好| 包皮开裂擦什么药膏| 下巴长痘痘用什么药| 怀疑哮喘要做什么检查| 妇科千金片和三金片有什么区别| ppb是什么单位| 天五行属性是什么| 消谷善饥是什么意思| 什么树林| 肝功能2项是指什么| 鹿角粉有什么功效和作用| 人怕出名猪怕壮是什么生肖| 不完全性右束支阻滞是什么意思| 性冷淡吃什么药| 什么的小学生| 脂肪肝应注意什么| 3人死亡属于什么事故| 腮腺炎用什么药| 题词是什么意思| 钠低吃什么| 大油边是什么| 半月板损伤吃什么药| 七月二号是什么日子| 司是什么级别| 什么发色显白| 女人内火旺喝什么降火| 寒咳嗽吃什么药止咳效果好| 对节木是什么树| 软组织是什么| 女生下体长什么样子| 什么样的人容易孕酮低| 益生菌是什么东西| 北京市长是什么级别| 什么虫子咬了像针扎一样疼| afar是什么意思| 什么时候喝牛奶最好| 语塞是什么意思| 为什么叫客家人| 前列腺钙化有什么影响| 腰椎间盘突出适合什么运动| 2023年属兔的是什么命| 学名是什么意思| 五分类血常规检查什么| 胃食管反流挂什么科| 梦见离家出走是什么意思| 什么是性冷淡| 汉族为什么叫汉族| 舌苔发黑是什么病| 检查肛门挂什么科| 猪肉什么馅的饺子好吃| 魔芋是什么东西| 腊排骨炖什么好吃| 肺部散在小结节是什么意思| 梦见网鱼是什么征兆| 什么是药食同源| 为什么老是睡不着| scr医学上是什么意思| kick什么意思| 女性长期便秘挂什么科| 尿酸高什么意思| 从此萧郎是路人是什么意思| 什么是传染性软疣| 阿莫西林治什么| 女人消瘦应该检查什么| 仙人板板 是什么意思| 肚脐眼右边是什么器官| 比重是什么意思| 箱涵是什么| 鼻子大说明什么| 总胆红素高是什么意思| acb是什么意思| 头痛吃什么药最好| 齐人之福什么意思| 美国什么时候建国的| 2月27号是什么星座| 段泥紫砂壶适合泡什么茶| 电光性眼炎用什么眼药水| 抗环瓜氨酸肽抗体高是什么意思| 纣王叫什么名字| mrv是什么检查| 水疗是什么意思| 毒龙是什么意思啊| 热伤风吃什么药| 宰相和丞相有什么区别| 因果报应是什么意思| 肺气不足吃什么食物可以补肺气| 39什么意思| 中老年人补钙吃什么牌子的钙片好| 经常干咳是什么原因| 梦见生男孩是什么征兆| 梦见卖东西是什么意思| 什么是机械手表| 小肠是干什么的| chloe是什么牌子| 细菌性感冒吃什么药效果好| 国窖1573是什么香型| 脸红是什么大病的前兆| 人乳头病毒是什么意思| 红斑狼疮是什么症状能治好吗| gf是什么意思| 玉帝和王母是什么关系| 辅料是什么意思| 蛋白质变性的本质是什么| 2月27是什么星座| 狗拉肚子吃什么药| 紫字五行属什么| 乳房有溢液是什么原因| 九九年属什么| 二花是什么中药| 花甲和什么不能一起吃| 6月23日什么星座| 卡点是什么意思| 久旱逢甘露是什么意思| 做爱时间短吃什么药好| 天天喝白酒对身体有什么危害| 月经推迟7天是什么原因| 吐血是什么病| plg是什么意思| 臭虫长什么样| 厌氧菌感染用什么药| 崛起是什么意思| 燃气泄露是什么味道| 牵强是什么意思| 干咳无痰是什么原因| 为什么会得脂溢性皮炎| 颈椎ct能检查出什么| 禹五行属什么| 得了幽门螺杆菌是什么症状| 三月份有什么节日| 奔走相告的走是什么意思| 特斯拉是什么电池| 五月21号是什么星座| 煎中药用什么锅| 黄芪什么功效| 下眼袋浮肿是什么原因| 人流后需要注意什么| 肠炎能吃什么食物| 手上三条线分别代表什么| c2是什么车型| 66什么意思| 不知为什么| 跛脚是什么意思| 白猫来家里有什么预兆| 4.12是什么星座| 百度Saltu al enhavo

北京市怀柔区人民政府 关于干部职务任免的...

El Vikipedio, la libera enciklopedio
Dokumentado Dokumentado

百度 后冀中星将广东省公安厅告上广州中院,要求其公开殴打致残案的复查结论,广东中院表示不予受理。


?ablona programado Diskutoj Lua Testoj Subpa?oj
Modulo Esperanto English

Modulo: Dokumentado


Rekrei


Se vi havas demandon pri ?i tiu Lua-modulo, tiam vi povas demandi en la diskutejo pri Lua-moduloj. La Intervikiaj ligiloj estu metataj al Vikidatumoj. (Vidu Helpopa?on pri tio.)
--[[
------------------------------------------------------------------------------------
--                               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
梦见木头是什么意思 脖子爱出汗是什么原因 梦见一个人代表什么 錾是什么意思 秋葵长什么样
打嗝是什么原因 指导员是什么级别 2005属什么 为什么香蕉不能放冰箱 homme是什么意思
淋病有什么症状 所不欲勿施于人是什么意思 男性漏尿是什么原因 蛋白质变性的本质是什么 武汉属于什么地区
高脂血症是什么意思 上海最高楼叫什么大厦有多少米高 女生自慰什么感觉 朋友梦到我怀孕了是什么意思 赵构为什么杀岳飞
一览无余是什么意思hcv8jop2ns8r.cn 坐飞机不能带什么物品hcv9jop7ns2r.cn 贱人的意思是什么意思hcv8jop1ns9r.cn 打磨工为什么没人干hcv9jop5ns4r.cn 指甲变黄是什么原因hcv8jop0ns9r.cn
胸部b超挂什么科hcv9jop1ns5r.cn 肺炎衣原体阳性是什么意思kuyehao.com 平板撑有什么作用xinmaowt.com 进国企需要什么条件hcv7jop7ns0r.cn 怀孕前期有什么征兆hcv8jop9ns7r.cn
00年属龙的是什么命aiwuzhiyu.com 五心烦热是什么意思hcv8jop5ns8r.cn 拆台是什么意思hcv9jop2ns5r.cn 30如狼40如虎是什么意思hcv7jop6ns3r.cn 羊和什么生肖最配hcv8jop2ns6r.cn
西南方向是什么方位hcv9jop6ns1r.cn 头发出油是什么原因hcv8jop7ns9r.cn 8月10日什么星座hcv7jop5ns5r.cn 梦到车被撞了什么预兆hcv8jop0ns3r.cn 螃蟹苦是什么原因hcv8jop1ns0r.cn
百度