Hopp til innhold

Bruker:Jeblad/Module:JSONstat/dok

Fra Wikipedia, den frie encyklopedi
Sideversjon per 16. aug. 2015 kl. 05:41 av Jeblad (diskusjon | bidrag) (Ny side: The purpose of this module is to demonstrate handling of JSON-stat in Lua with closure-based instances modelled as lazy facades. The instances will not be created before boundraries are...)
(diff) ← Eldre sideversjon | Nåværende sideversjon (diff) | Nyere sideversjon → (diff)

The purpose of this module is to demonstrate handling of JSON-stat in Lua with closure-based instances modelled as lazy facades. The instances will not be created before boundraries are passed, that is a method returns a value that is wrapped in a closure. This makes a fairly efficient implementation for simple access, but it is not very efficient as it does not cache much of the processing.

The library ca be used by simple calls through the invoke parser function, but it is really made as a support library. A main purpose for the lib is to provide Vega-formatted data, often constrained or adapted somehow to fit better with other available data.

Primary access point is the load-method, which will parse one of several sources and return an instance according to the provided data. In Lua-code the instance can be navigated by using provided methods, while in wikitext it is possible to use layout (format) parameters.