Binding of Isaac: Rebirth Wiki
(searchData() déplacée)
(Utilisation sur pages HTML)
Ligne 39 : Ligne 39 :
   
   
function p.searchData( mainTable, typeTable, value )
+
function p.searchData( f )
  +
local args = p.trimAll( p.getArgs( f ) )
if typeTable then
 
if p[mainTable][typeTable] then
+
if args.typeTable then
for i, j in pairs( p[mainTable][typeTable] ) do
+
if p[args.mainTable][args.typeTable] then
  +
for i, j in pairs( p[args.mainTable][args.typeTable] ) do
if value == i then
+
if args.value == i then
 
return j
 
return j
 
end
 
end
Ligne 50 : Ligne 51 :
 
end
 
end
 
 
for k, l in pairs( p[mainTable] ) do
+
for k, l in pairs( p[args.mainTable] ) do
for m, n in pairs( p[mainTable][k] ) do
+
for m, n in pairs( p[args.mainTable][k] ) do
if value == m then
+
if args.value == m then
 
return n
 
return n
 
end
 
end

Version du 31 octobre 2017 à 07:47

La documentation pour ce module peut être créée à Module:Data/doc

local p = {}

p.wikiName = {
--	["simplified_name"] = "name_to_use_in_the_wiki",
	item = {
	},
	monster = {
	},
	trinket = {
	}
}


p.displayName = {
--	["name_used_in_the_wiki"] = "name_to_display",
	item = {
	},
	monster = {
	},
	trinket = {
	}
}


p.imageSize = {
--	["icon_name"] = { { file_width, file_weight },
--		another_image = { file_width, file_weight },
--		another_image = { file_width, file_weight }, }
	item = {
	},
	monster = {
		["attack fly"] = { { 19, 10 },
			anim = { 19, 15 }, },
		["gaper"] = { { 28, 33 }, },
	},
	trinket = {
	}
}


function p.searchData( f )
	local args = p.trimAll( p.getArgs( f ) )
	if args.typeTable then
		if p[args.mainTable][args.typeTable] then
			for i, j in pairs( p[args.mainTable][args.typeTable] ) do
				if args.value == i then
					return j
				end
			end
		end
	end
	
	for k, l in pairs( p[args.mainTable] ) do
		for m, n in pairs( p[args.mainTable][k] ) do
			if args.value == m then
				return n
			end
		end
	end
end

return p