| 1 | From: Jakub Jirutka <[email protected]>
|
| 2 | Date: Sun, 18 Dec 2022 19:43:00 +0100
|
| 3 | Subject: [PATCH] Add support for cjson
|
| 4 |
|
| 5 | |
| 6 | |
| 7 | @@ -36,14 +36,16 @@
|
| 8 |
|
| 9 | --- Load configuration from a JSON file.
|
| 10 | ---
|
| 11 | - --- Requires the "dkjson"[1] module to be present on the system. Get it with:
|
| 12 | + --- Requires the "cjson"[1] or "dkjson"[2] module to be present on the system. Get it with:
|
| 13 | ---
|
| 14 | - --- luarocks install dkjson
|
| 15 | + --- luarocks install cjson
|
| 16 | ---
|
| 17 | - --- [1] http://dkolf.de/src/dkjson-lua.fsl/home
|
| 18 | + --- [1] https://www.kyne.com.au/~mark/software/lua-cjson.php
|
| 19 | + --- [2] http://dkolf.de/src/dkjson-lua.fsl/home
|
| 20 | from_json = function(filepath)
|
| 21 | local src, config, _, err
|
| 22 | - local json = require 'dkjson'
|
| 23 | + local ok, json = pcall(require, 'cjson')
|
| 24 | + if not ok then json = require 'dkjson' end
|
| 25 |
|
| 26 | src, err = read_file(filepath)
|
| 27 |
|