Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Join the Playtest on Steam Now: SpiritVale

Module:GameInfo/doc: Difference between revisions

From SpiritVale Wiki
Created page with "Module:GameInfo is the stable entrypoint for SpiritVale “GameInfo” renderers (Phase 4.1). == Contract == Pages are generated/updated by SVWT + pywikibot (compiled artifacts). This module reads arguments from <code>frame.args</code> only (no parent-frame wrappers). Submodules are pure renderers and must export <code>render(frame)</code>. == Entry points == <pre>{{#invoke:GameInfo|Skills|id=...|index=...|notes=...|data=...}}</pre> <pre>{{#invoke:GameInfo|Category|nam..."
Tags: Mobile edit Mobile web edit
 
No edit summary
Tags: Mobile edit Mobile web edit
 
Line 7: Line 7:


== Entry points ==
== Entry points ==
<pre>{{#invoke:GameInfo|Skills|id=...|index=...|notes=...|data=...}}</pre>
<pre><nowiki>{{#invoke:GameInfo|Skills|id=...|index=...|notes=...|data=...}}</nowiki></pre>
<pre>{{#invoke:GameInfo|Category|name=Skills|...}}</pre>
<pre><nowiki>{{#invoke:GameInfo|Category|name=Skills|...}}</nowiki></pre>


The Category router is allowlist-only. Users cannot force arbitrary <code>require()</code> targets.
The Category router is allowlist-only. Users cannot force arbitrary <code>require()</code> targets.
Line 22: Line 22:
* <code>Module:GameInfo/styles.css</code>
* <code>Module:GameInfo/styles.css</code>
Submodules may override by setting:
Submodules may override by setting:
* <code>STYLE_SRC = "Module:GameInfo/skills.css"</code>
<pre><nowiki>STYLE_SRC = "Module:GameInfo/skills.css"</nowiki></pre>


== Shared scaffolding ==
== Shared scaffolding ==
Line 30: Line 30:
* <code>bool(frame, key, fallback)</code> supports 1/0, true/false, yes/no.
* <code>bool(frame, key, fallback)</code> supports 1/0, true/false, yes/no.


=== Container builder ===
=== Container builder ==
<code>box(opts)</code> creates the canonical card shell:
<code>box(opts)</code> creates the canonical card shell:
* root: <code>div.sv-gi-card</code>
* root: <code>div.sv-gi-card</code>
Line 54: Line 54:
== Debug / wiring test ==
== Debug / wiring test ==
A simple sanity check exists:
A simple sanity check exists:
<pre>{{#invoke:GameInfo|skeleton|id=sv-gi-test-1|level=1|max=10|variant=skills}}</pre>
<pre><nowiki>{{#invoke:GameInfo|skeleton|id=sv-gi-test-1|level=1|max=10|variant=skills}}</nowiki></pre>


[[Category:Lua modules]]
[[Category:Lua modules]]

Latest revision as of 05:09, 25 February 2026

Module:GameInfo is the stable entrypoint for SpiritVale “GameInfo” renderers (Phase 4.1).

Pages are generated/updated by SVWT + pywikibot (compiled artifacts). This module reads arguments from frame.args only (no parent-frame wrappers). Submodules are pure renderers and must export render(frame).

Entry points

edit source
{{#invoke:GameInfo|Skills|id=...|index=...|notes=...|data=...}}
{{#invoke:GameInfo|Category|name=Skills|...}}

The Category router is allowlist-only. Users cannot force arbitrary require() targets.

GameInfo routes only to modules listed in the internal allowlist. Currently supported:

TemplateStyles

edit source

GameInfo always emits one TemplateStyles tag per invocation. Default CSS:

  • Module:GameInfo/styles.css

Submodules may override by setting:

STYLE_SRC = "Module:GameInfo/skills.css"

Shared scaffolding

edit source

Args helpers

edit source
  • arg(frame, key, fallback) trims and returns a string.
  • int(frame, key, fallback, min, max) clamps integers.
  • bool(frame, key, fallback) supports 1/0, true/false, yes/no.

= Container builder

edit source

box(opts) creates the canonical card shell:

  • root: div.sv-gi-card
  • top: div.sv-gi-top
  • bottom: div.sv-gi-bottom

Data attributes:

  • data-gi="1"
  • data-gi-phase="4.1"
  • data-level, data-max-level

Optional:

  • id (or root_id)
  • variant adds class sv-gi--<variant>

Convenience renderer

edit source

render_box(opts) builds the box and fills top/bottom with either HTML nodes or wikitext.

Error handling

edit source

If a route cannot be loaded or throws, GameInfo returns TemplateStyles plus a wiki-friendly error box:

  • div.sv-gi-error

Debug / wiring test

edit source

A simple sanity check exists:

{{#invoke:GameInfo|skeleton|id=sv-gi-test-1|level=1|max=10|variant=skills}}