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:
-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