Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpx/lua-cjson.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Pulford <mark@kyne.com.au>2016-08-25 14:04:35 +0300
committerMark Pulford <mark@kyne.com.au>2016-08-25 14:55:14 +0300
commitdb12267686af80f0a3643897d09016c137715c8a (patch)
treef403359d3d049dc0a1950818d3298ed5558a97b8
parent013b277228cec6429f0ab084cf3251a2d6594855 (diff)
Update cjson.util to workaround missing "unpack"
-rw-r--r--lua/cjson/util.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/lua/cjson/util.lua b/lua/cjson/util.lua
index 6916dad..5bb0d7d 100644
--- a/lua/cjson/util.lua
+++ b/lua/cjson/util.lua
@@ -10,6 +10,11 @@ local json = require "cjson"
-- -1 Not an array
-- 0 Empty table
-- >0 Highest index in the array
+
+-- Provide unpack for Lua 5.3+ built without LUA_COMPAT_UNPACK
+local unpack = unpack
+if table.unpack then unpack = table.unpack end
+
local function is_array(table)
local max = 0
local count = 0