Module:Abilities/utils

From Deadlock Wiki
Revision as of 11:12, 1 October 2024 by Saag (talk | contribs) (Created page with "-- returns the table of a specific item function get_ability(hero_name, ability_num) local hero_key = get_hero_key(hero_name) if(hero_key == nil) then return "Hero Not Found" end return data[hero_key][tonumber(ability_num)] end function get_hero_key(hero_name) for i, hero in pairs(data) do if hero["Name"] == hero_name then return i end end return nil end")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Overview

Common internal functions that are shared amongst any Abilities/ modules

Submodules

Abilities - Simple functions. Eg. getting ability name

Abilities/utils - Common internal functions that are shared amongst any Abilities/ modules

Abilities/card - Generates hero ability cards

Abilities/icon - Searches for an icon based on the (English) name of the ability

Abilities/details table (WIP) - Generates details table to show raw ability data


-- returns the table of a specific item
function get_ability(hero_name, ability_num)
	local hero_key = get_hero_key(hero_name)
	if(hero_key == nil) then return "Hero Not Found" end
	return data[hero_key][tonumber(ability_num)]
end

function get_hero_key(hero_name)
	for i, hero in pairs(data) do
		if hero["Name"] == hero_name then
			return i
		end
	end
	return nil
end