Module:HeroData/doc: Difference between revisions

Sur (talk | contribs)
m get_hero_var: recommend hero_key over hero_name, and describe each example
Sur (talk | contribs)
m added hero_key example to get_list_elem, and added info that its preferred and recommended to use hero key over hero name in english
Line 15: Line 15:


====Parameters====
====Parameters====
* '''hero_name''' - Name of the hero in english, or key of the hero
* '''hero_name''' - Name of the hero in english, or key of the hero. Preferred and recommended to use hero key, as its much more efficient. Search for the key in [[Data:HeroData.json]]
* '''hero_var''' - Key of the hero's variable, see [[Data:HeroData.json]]
* '''hero_var''' - Key of the hero's variable, see [[Data:HeroData.json]]
* '''sig_figs_or_localize''' - OPTIONAL, # of sig figs to round to if retrieving a float, or "true" if its a string that should be localized. See Localizable values section.
* '''sig_figs_or_localize''' - OPTIONAL, # of sig figs to round to if retrieving a float, or "true" if its a string that should be localized. See Localizable values section.
Line 65: Line 65:


==== Parameters ====
==== Parameters ====
* '''hero_name''' - Name of the hero, in english
* '''hero_name''' - Name of the hero in english, or hero key. Preferred and recommended to use hero key, as its much more efficient. Search for the key in [[Data:HeroData.json]]
* '''hero_var''' - Key of the hero's variable, see [[Data:HeroData.json]]
* '''hero_var''' - Key of the hero's variable, see [[Data:HeroData.json]]
* '''number''' - Index to retrieve from the list. 1 for 1st element, 2 for 2nd element, etc.
* '''number''' - Index to retrieve from the list. 1 for 1st element, 2 for 2nd element, etc.
Line 72: Line 72:
==== Example ====
==== Example ====
From wikitext:<br>
From wikitext:<br>
Using hero name in english
<pre>{{#invoke:HeroData|get_list_elem|Abrams|WeaponTypes|2}}</pre>
<pre>{{#invoke:HeroData|get_list_elem|Abrams|WeaponTypes|2}}</pre>
{{#invoke:HeroData|get_list_elem|Abrams|WeaponTypes|2}}
{{#invoke:HeroData|get_list_elem|Abrams|WeaponTypes|2}}
Using hero key
<pre>{{#invoke:HeroData|get_list_elem|hero_atlas|WeaponTypes|2}}</pre>
{{#invoke:HeroData|get_list_elem|hero_atlas|WeaponTypes|2}}