antirez / lua-cmsgpack

A self contained Lua MessagePack C implementation.
355 stars 118 forks source link

Table with string number as key is mistreated as array. #24

Closed yihuang closed 11 years ago

yihuang commented 11 years ago
local mp = require 'cmsgpack'
local tbl = {['1']=1}
local s = mp.pack(tbl)
print('length:', #s)
print('first byte:', string.byte(s, 1))

The table {['1']=1} is encoded to \x90, which is for [].

The script above output like this:

length: 1
first byte: 144