Template:DataProp/doc: Difference between revisions

Vergir (talk | contribs)
Update not-found example to show error message (with help from vergir-bot LLM)
Vergir (talk | contribs)
Fix doc page: restore Weapon example, clean up duplicate sections (with help from vergir-bot LLM)
Line 4: Line 4:
Powered by [[Module:GameData|Module:GameData]].
Powered by [[Module:GameData|Module:GameData]].


For nested properties use dot notation e.g. <code>LevelScaling.TechPower</code>. It also automatically unwraps things like <code>DPS.Value</code>.
Dot notation is supported for nested properties (e.g. <code>Scale.Value</code>). Tables with a <code>Value</code> field are automatically unwrapped.


== Parameters ==
== Parameters ==
Line 34: Line 34:


=== Hero ===
=== Hero ===
<code>Drifter regenerates &#123;&#123;DataProp|Drifter|BaseHealthRegen&#125;&#125;HP each second.</code>
<code>Drifter regenerates &#123;&#123;DataProp|Drifter|BaseHealthRegen&#125;&#125; HP each second.</code>


Drifter regenerates {{DataProp|Drifter|BaseHealthRegen}}HP each second.
Drifter regenerates {{DataProp|Drifter|BaseHealthRegen}} HP each second.


=== Not found ===
=== Weapon ===
If the entity or property does not exist, the template returns a visible error message.
<code>Mo &amp; Krill fires &#123;&#123;DataProp|Mo & Krill|BulletsPerShot&#125;&#125; bullets per shot.</code>
 
<code>&#123;&#123;DataProp|Nonexistent Item|FakeProperty&#125;&#125;</code>
 
{{DataProp|Nonexistent Item|FakeProperty}}


<includeonly>[[Category:Data templates]]</includeonly><noinclude>[[Category:Template documentation]]</noinclude>
Mo & Krill fires {{DataProp|Mo & Krill|BulletsPerShot}} bullets per shot.


=== Ability ===
=== Ability ===
Line 58: Line 54:


=== Not found ===
=== Not found ===
If the entity or property does not exist, the template returns an empty string.
If the entity or property does not exist, the template returns a visible error message.


<code>&#123;&#123;DataProp|Nonexistent Item|FakeProperty&#125;&#125;</code>
<code>&#123;&#123;DataProp|Nonexistent Item|FakeProperty&#125;&#125;</code>


Result: "{{DataProp|Nonexistent Item|FakeProperty}}"
{{DataProp|Nonexistent Item|FakeProperty}}


<includeonly>[[Category:Data templates]]</includeonly><noinclude>[[Category:Template documentation]]</noinclude>
<includeonly>[[Category:Data templates]]</includeonly><noinclude>[[Category:Template documentation]]</noinclude>