-
Notifications
You must be signed in to change notification settings - Fork 11
Using JSON
hazzard993 edited this page Jul 10, 2019
·
1 revision
With TypeScriptToLua, it is possible to import JSON files.
TypeScript needs the --resolveJsonModule
option to be true to do this.
This transforms the .json and .ts file involved into a Lua format. The JSON's contents are also type checked with the project before being transformed.
This can be useful for configuration files.
{
"debug": true
}
import * as config from "./config.json";
if (config.debug) {
enableDebuggingConsole();
player.hp = Infinity;
}