RogerDodger (talk | contribs) No edit summary |
RogerDodger (talk | contribs) No edit summary |
||
Line 3: | Line 3: | ||
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. | 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 | The name of this module is short for Object, which is what JSON calls its key-value pair data structure. | ||
== Usage == | == Usage == |
Revision as of 10:01, 5 September 2023
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("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