tstl-json-lua
TypeScript icon, indicating that this package has built-in type declarations

0.0.0 • Public • Published

TSTL json.lua

Declarations for json.lua, A lightweight JSON library for Lua.

Command Description
yarn add -D tstl-json-lua Install these declarations
yarn add rxi/json.lua Install json.lua

Upon installation these declarations can be linked to a tsconfig.json file.

{
    "compilerOptions": {
        "types": [
            "tstl-json-lua"
        ]
    }
}

And used within any .ts file.

import * as json from "json";

let s = json.encode({
    n: 42,
    s: "Hello world"
});

print(json.decode(s));

Make sure to append ";./node_modules/json.lua/?.lua" to your package.path in a conf.ts file (this is run first) to assist where Lua looks for modules.

package.path += ";./node_modules/json.lua/?.lua";

Also you need to add "typescript-to-lua/language-extensions" to tsconfig.json file.

{
    "compilerOptions": {
        "types": [
            "typescript-to-lua/language-extensions"
        ]
    }
}

Package Sidebar

Install

npm i tstl-json-lua

Weekly Downloads

1

Version

0.0.0

License

ISC

Unpacked Size

2.61 kB

Total Files

3

Last publish

Collaborators

  • maxiy01