Module:Util/tables/iteratee/Documentation/Snippets: Difference between revisions

From Zelda Wiki, the Zelda encyclopedia
Jump to navigation Jump to search
No edit summary
No edit summary
Line 25: Line 25:


function p.iterateeTbl()
function p.iterateeTbl()
end
local game = {
 
abbr = "OoA",
function p.iterateeFunc()
title = "Oracle of Ages",
end
}
 
local iteratee = util.tables.iteratee({game = "OoA"})
function p.iterateeNil()
return iteratee(game)
end
end


return p
return p

Revision as of 21:26, 12 May 2024

Documentation for this module may be created at Module:Util/tables/iteratee/Documentation/Snippets/Documentation

local p = {}

local util = {
	tables = {
		iteratee = require("Module:Util/tables/iteratee")
	}
}

function p.iterateeStr1()
	local game = {
		abbr = "OoA", 
		title = "Oracle of Ages",
	}
	local iteratee = util.tables.iteratee("abbr")
	return iteratee(game)
end

function p.iterateeStr2()
	local game = {
		title = "Bayonetta",
	}
	local iteratee = util.tables.iteratee("abbr")
	return iteratee(game)
end

function p.iterateeTbl()
	local game = {
		abbr = "OoA",
		title = "Oracle of Ages",
	}
	local iteratee = util.tables.iteratee({game = "OoA"})
	return iteratee(game)
end

return p