mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
fix loading frontend/JSON.lua for json.lua on Kindle
The VFAT file system of `/mnt/us` is case insensitive so that
require("json") from Spore which intends to load luajson module in
rock directory actually will load `frontend/JSON.lua`, the two JSON
parser libraries have slightly different APIs.
This patch remove the pure Lua JSON library in favor of `luajson` which
uses LPeg pattern marching backend for better performance.
This commit is contained in:
@@ -4,7 +4,7 @@ local InfoMessage = require("ui/widget/infomessage")
|
||||
local UIManager = require("ui/uimanager")
|
||||
local Geom = require("ui/geometry")
|
||||
local Screen = require("device").screen
|
||||
local JSON = require("JSON")
|
||||
local JSON = require("json")
|
||||
local DEBUG = require("dbg")
|
||||
local _ = require("gettext")
|
||||
local T = require("ffi/util").template
|
||||
@@ -69,7 +69,7 @@ function ReaderDictionary:stardictLookup(word, box)
|
||||
std_out:close()
|
||||
end
|
||||
--DEBUG("result str:", word, results_str)
|
||||
local ok, results = pcall(JSON.decode, JSON, results_str)
|
||||
local ok, results = pcall(JSON.decode, results_str)
|
||||
if ok and results then
|
||||
--DEBUG("lookup result table:", word, results)
|
||||
self:showDict(word, tidy_markup(results), box)
|
||||
|
||||
Reference in New Issue
Block a user