mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-05-07 12:04:50 +02:00
27 lines
921 B
Diff
27 lines
921 B
Diff
From: Jakub Jirutka <jakub@jirutka.cz>
|
|
Date: Sun, 18 Dec 2022 19:43:00 +0100
|
|
Subject: [PATCH] Add support for cjson
|
|
|
|
--- a/src/cliargs/config_loader.lua
|
|
+++ b/src/cliargs/config_loader.lua
|
|
@@ -36,14 +36,16 @@
|
|
|
|
--- Load configuration from a JSON file.
|
|
---
|
|
- --- Requires the "dkjson"[1] module to be present on the system. Get it with:
|
|
+ --- Requires the "cjson"[1] or "dkjson"[2] module to be present on the system. Get it with:
|
|
---
|
|
- --- luarocks install dkjson
|
|
+ --- luarocks install cjson
|
|
---
|
|
- --- [1] http://dkolf.de/src/dkjson-lua.fsl/home
|
|
+ --- [1] https://www.kyne.com.au/~mark/software/lua-cjson.php
|
|
+ --- [2] http://dkolf.de/src/dkjson-lua.fsl/home
|
|
from_json = function(filepath)
|
|
local src, config, _, err
|
|
- local json = require 'dkjson'
|
|
+ local ok, json = pcall(require, 'cjson')
|
|
+ if not ok then json = require 'dkjson' end
|
|
|
|
src, err = read_file(filepath)
|
|
|