Template:O

Template page
Revision as of 08:15, 5 September 2023 by RogerDodger (talk | contribs) (Created page with "<includeonly>{{#invoke:O|encode}}</includeonly><noinclude>{{documentation}}</noinclude>")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This template encodes its arguments into JSON and then hex encodes the JSON. These arguments can then later be decoded by Module:O. This allows templates to use more complicated data structures for their arguments with ordinary wikitext syntax.

The name of this module is short for Object, which is what JSON calls its key-value pair data structure.

Usage

{{PunisherTable
  |standing={{o
    |{{o|frames=-10|id=Bryan-2,3}}
    |{{o|frames=-10|id=Bryan-1,4}}
  }}
  |crouching={{o
    |{{o|frames=-11|id=ws4}}
    |{{o|frames=-15|id=ws1|combo=?}}
  }}
}}

Later, in a Lua module called by {{PunisherTable}}:

local O = require("Module:O")

p.main = function(frame) do
  local standing = O.decode( frame:getParent().args.standing )
  for k,v in pairs(standing)
    standing[k] = O.decode(v)
  end
end

Example

5b223762323236363732363136643635373332323361323232643331333032323263323236393634323233613232343237323739363136653264333232633333323237645c6e2020222c223762323236363732363136643635373332323361323232643331333032323263323236393634323233613232343237323739363136653264333132633334323237645c6e225d