json

v0.1.3·Updated 2024-04-17

Exposes json.lua as a module using lovely

About this mod Author’s original text

This is a package mirror of rxi's json.lua with an added lovely patch

The provided lovely patch adds it under the module name "json". A modified extract from the project's original readme follows...

A lightweight JSON library for Lua

Usage

json = require "json"

The library provides the following functions:

json.encode(value)

Returns a string representing value encoded in JSON.

json.encode({ 1, 2, 3, { x = 10 } }) -- Returns '[1,2,3,{"x":10}]'

json.decode(str)

Returns a value representing the decoded JSON string.

json.decode('[1,2,3,{"x":10}]') -- Returns { 1, 2, 3, { x = 10 } }

Notes

  • Trying to encode values which are unrepresentable in JSON will never result

in type conversion or other magic: sparse arrays, tables with mixed key types

or invalid numbers (NaN, -inf, inf) will raise an error

  • null values contained within an array or object are converted to nil and

are therefore lost upon decoding

Pretty* encoding is not supported, json.encode() only encodes to a compact

format

License

This library is free software; you can redistribute it and/or modify it under

the terms of the MIT license. See LICENSE for details.

Install & use Install: follow the bundled instructions

  1. Unzip the archive from playbuff and read the bundled readme / instructions first.
  2. Most mods rely on the game's mod loader — the usual route is a community mod manager (such as r2modman): pick this game, install, and it handles the loader and dependencies.
  3. For a manual install, put the mod files into the matching Mod / plugins folder inside the game directory.
  4. Launch the game to confirm it loaded; mods with listed dependencies need those installed as well.

Install locations vary a lot between mods — the bundled readme is the most reliable guide. These mods need a community loader first — the bundled readme usually points to its download.

Dependencies

Install these first, or the mod will not work:

lovely

File & checksum

Filename
json-0.1.3.zip
File size
14.2 KiB