diff options
author | Mark Pulford <mark@kyne.com.au> | 2016-08-25 14:04:35 +0300 |
---|---|---|
committer | Mark Pulford <mark@kyne.com.au> | 2016-08-25 14:55:14 +0300 |
commit | db12267686af80f0a3643897d09016c137715c8a (patch) | |
tree | f403359d3d049dc0a1950818d3298ed5558a97b8 | |
parent | 013b277228cec6429f0ab084cf3251a2d6594855 (diff) |
Update cjson.util to workaround missing "unpack"
-rw-r--r-- | lua/cjson/util.lua | 5 |
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 |