Module:Environments

---	Environments contains details of Risk of Rain 2's environments. --	--	@module		enemies --	@alias		p --	@author		User:Thundermaker300 --	@attribution	All who helped to update enemy infoboxes --	@require	Module:Environments/Data --	@release	stable --

local EnvData = mw.loadData('Module:Environments/Data').Environments

local p = {} table.unpack = unpack	-- pre-Lua 5.3 table library does not have unpack function

---	Builds a template for an environment's expansion. --	@function		p.EnvironmentExpansion --	@param			{table} frame Frame object --	@return			{string} Preprocessed wikitext of expansion template. function p.EnvironmentExpansion(frame) local data = EnvData[frame.args[1]] if data == nil then return "" end return data.Expansion and frame:preprocess("") or "" end

local env_infobox = [=[

]=]

---	Builds a template for an environment's infobox. --	@function		p.EnvInfobox --	@param			{table} frame Frame object --	@return			{string} Preprocessed wikitext of environment infobox. function p.EnvInfobox(frame) local data = EnvData[frame.args[1]] if data == nil then return error("Invalid environment!") end return frame:preprocess(string.format( env_infobox, data.Name, data.Image, data.SubName or "", data.Stage or "Unknown", data.Soundtrack or "Unknown", data.LunarSeer or "" )) end

return p