0.0.0 • Published 4 years ago
tstl-json-lua v0.0.0
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"
]
}
}0.0.0
4 years ago