Skip to content

Commit dcdfe33

Browse files
committed
btc: also usuable with cjson
1 parent 52e9b72 commit dcdfe33

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

contrib/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ Supported platforms: Linux (required tools: `sysfs`)
6464

6565
Provides current Bitcoin price in any currency by code (
6666
https://en.wikipedia.org/wiki/ISO_4217).
67-
Supported platforms: Linux, FreeBSD (required tools: `curl`)
67+
Requires `curl` and one of the following json libraries:
68+
- [lua-cjson](https://github.com/mpx/lua-cjson/))
69+
- [luajson](https://github.com/harningt/luajson/)
70+
Supported platforms: Linux, FreeBSD
6871

6972
- Arguments:
7073
* takes currency code, i.e. `"usd"`, `"rub"` and other. `"usd"` by

contrib/btc_all.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ local setmetatable = setmetatable
88
local pcall = pcall
99
local helpers = require("vicious.helpers")
1010
local spawn = require("awful.spawn")
11-
local json = require("json")
11+
12+
local success, json = pcall(require, "cjson")
13+
if not success then
14+
json = require("json")
15+
end
16+
1217
local string = {
1318
sub = string.sub,
1419
upper = string.upper,

0 commit comments

Comments
 (0)