{"id":7429,"date":"2013-05-10T11:07:29","date_gmt":"2013-05-10T02:07:29","guid":{"rendered":"http:\/\/fukata.org\/?p=7429"},"modified":"2017-08-11T22:58:47","modified_gmt":"2017-08-11T22:58:47","slug":"overhead-json-decode-in-lua","status":"publish","type":"post","link":"https:\/\/blog.fukata.org\/archives\/7429\/","title":{"rendered":"lua\u3067\u306ejson\u30c7\u30b3\u30fc\u30c9\u306e\u30aa\u30fc\u30d0\u30fc\u30d8\u30c3\u30c9\u304c\u7121\u8996\u3067\u304d\u306a\u3044\u30ec\u30d9\u30eb\u3060\u3063\u305f\u306e\u3067MessagePack\u3092\u63a1\u7528\u3057\u305f\u3089\u30b9\u30eb\u30fc\u30d7\u30c3\u30c8\u304c3.6\u500d\u306b\u306a\u3063\u305f"},"content":{"rendered":"
\u3068\u3042\u308bAPI\u30b5\u30fc\u30d0\u3092lua\u3067\u5b9f\u88c5\u3057\u3066\u3044\u305f\u3089\u601d\u3046\u3088\u3046\u306b\u30b9\u30eb\u30fc\u30d7\u30c3\u30c8\u304c\u4f38\u3073\u306a\u304b\u3063\u305f\u306e\u3067\u3001\u30c7\u30d0\u30c3\u30b0\u3057\u3066\u307f\u305f\u3068\u3053\u308d\u3001json\u30c7\u30b3\u30fc\u30c9\u306e\u90e8\u5206\u3067\u9045\u304f\u306a\u3063\u3066\u3044\u305f\u6a21\u69d8\u3002<\/p>\n
\u7d50\u679c\u3001json4lua -> lua-cjson -> mplua\u3068\u3044\u3046\u98a8\u306b\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u5909\u3048\u3066\u30c7\u30d0\u30c3\u30b0\u3057\u3066\u307f\u305f\u3068\u3053\u308d\u3001mplua\u3092\u4f7f\u3063\u305f\u5834\u5408\u304c\u4e00\u756a\u30b9\u30eb\u30fc\u30d7\u30c3\u30c8\u304c\u9ad8\u304b\u3063\u305f\u306e\u3067json\u3092\u6b62\u3081\u3066MessagePack\u3092\u63a1\u7528\u3057\u305f\u3068\u3053\u308d\u30ea\u30d5\u30a1\u30af\u30bf\u30ea\u30f3\u30b0\u59cb\u3081\u308b\u524d\u306b\u6bd4\u3079\u308b\u30683.6\u500d\u307e\u3067\u30b9\u30eb\u30fc\u30d7\u30c3\u30c8\u304c\u5411\u4e0a\u3057\u305f\u3002<\/p>\n
<\/p>\n
\u76ee\u6b21<\/p>
lua4json -> lua-cjson\u306b\u3059\u308b\u3060\u3051\u3067\u30822.5\u500d\u5f31\u7a0b\u5ea6\u30b9\u30eb\u30fc\u30d7\u30c3\u30c8\u304c\u5411\u4e0a\u3057\u305f\u3002 lua-cjson\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306f\u3059\u3093\u306a\u308a\u884c\u304f\u306e\u3068\u3001\u30e9\u30a4\u30d6\u30e9\u30ea\u306eAPI\u81ea\u4f53\u3082lua4json\u3068\u5909\u308f\u3089\u306a\u3044\u306e\u3067\u5272\u611b\u3057\u307e\u3059\u3002<\/p>\n libmessagepack\u306elua binding\u3067\u3042\u308bmplua\u3092\u4f7f\u3063\u3066\u307f\u307e\u3057\u305f\u3002 libmsgpack.hpp\u304c\u5fc5\u8981\u306b\u306a\u308b\u306e\u3067\u3001\u4e0b\u8a18\u3092DL\u3057\u3001\u30b3\u30ec\u81ea\u4f53\u3082\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304a\u304d\u307e\u3059\u3002 \u30b3\u30f3\u30d1\u30a4\u30eb\u3001\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u307e\u3067\u306f\u4e0a\u8a18\u3067\u3044\u3051\u308b\u3093\u3067\u3059\u304c\u3001msgpack.so\u304c\/msgpack.so\u306b\u51fa\u6765\u3066\u3057\u307e\u3046\u305f\u3081\uff08\u7279\u306breadme\u306b\u306f\u66f8\u3044\u3066\u306a\u304b\u3063\u305f\u3051\u3069\u3001prefix\u306a\u3069\u304c\u6307\u5b9a\u3067\u304d\u305f\u3093\u3060\u308d\u3046\u304b\u3002\u3002\u3002\uff09\u3001\u79fb\u3059\u306e\u3068libmsgpack.so.3\u3092\u914d\u7f6e\u3057\u76f4\u3059\u3002<\/p>\n \u3053\u308c\u3067\u3001lua\u5074\u304b\u3089\u6b63\u5e38\u306b\u8aad\u307f\u8fbc\u3081\u308b\u69d8\u306b\u306a\u3063\u305f\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n lua-cjson\u306b\u3059\u308b\u3053\u3068\u3067\u5143\u3005\u306e2.5\u500d\u5f31\u306b\u306a\u3063\u305f\u304c\u3001MessagePack\u30673.6\u500d\u7a0b\u5ea6\u307e\u3067\u5411\u4e0a\u3057\u305f\u3002<\/p>\n \u521d\u3081\u3066\u30ad\u30e3\u30c3\u30b7\u30e5\u306e\u30c7\u30fc\u30bf\u3068\u3057\u3066MessagePack\u3092\u4f7f\u3063\u3066\u307f\u305f\u3051\u3069\u3001\u30ad\u30e3\u30c3\u30b7\u30e5\u3059\u308b\u5074\uff08\u4eca\u56de\u306fPerl\u306eData::MessagePack\u3092\u4f7f\u7528\uff09\u3082\u5229\u7528\u3059\u308b\u5074\u3082\u82e6\u52b4\u3059\u308b\u3053\u3068\u7121\u304f\u5229\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u3001json\u304b\u3089\u306e\u30ea\u30d7\u30ec\u30a4\u30b9\u3082\u6bd4\u8f03\u7684\u7c21\u5358\u306a\u306e\u3067\u30aa\u30b9\u30b9\u30e1\u3002<\/p>\n \u305f\u3060\u30011\u70b9\u30cf\u30de\u3063\u305f\u3068\u3053\u308d\u3068\u3057\u3066\u3001\u3053\u308c\u306fMessagePack\u304c\u60aa\u3044\u308f\u3051\u3067\u306f\u306a\u304f\u3001MessagePack\u306e\u30c7\u30fc\u30bf\u3092Redis\u304b\u3089\u53d6\u308d\u3046\u3068\u3057\u305f\u3068\u3053\u308d\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30e9\u30a4\u30d6\u30e9\u30ea\u304c\u30d0\u30a4\u30ca\u30ea\u30bb\u30fc\u30d5\u3067\u306f\u306a\u304f\u3001\u3046\u307e\u304f\u30c7\u30b3\u30fc\u30c9\u51fa\u6765\u306a\u304b\u3063\u305f\u3068\u3053\u308d\u3002\u30b3\u30ec\u306f\u6b21\u56de\u66f8\u304f\u3002\uff08\u306f\u305a<\/p>\n \u8ffd\u8a18: 2013.05.10 11:55<\/strong> \u8ffd\u8a18: 2013.05.10 18:49<\/strong> \u3068\u3042\u308bAPI\u30b5\u30fc\u30d0\u3092lua\u3067\u5b9f\u88c5\u3057\u3066\u3044\u305f\u3089\u601d\u3046\u3088\u3046\u306b\u30b9\u30eb\u30fc\u30d7\u30c3\u30c8\u304c\u4f38\u3073\u306a\u304b\u3063\u305f\u306e\u3067\u3001\u30c7\u30d0\u30c3\u30b0\u3057\u3066\u307f\u305f\u3068\u3053\u308d\u3001json\u30c7\u30b3\u30fc\u30c9\u306e\u90e8\u5206\u3067\u9045\u304f\u306a\u3063\u3066\u3044\u305f\u6a21\u69d8\u3002 \u7d50\u679c\u3001json4lua -> lua-cjso … \u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":2,"featured_media":9223372036854775807,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1980],"tags":[1029,1028],"_links":{"self":[{"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/posts\/7429"}],"collection":[{"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/comments?post=7429"}],"version-history":[{"count":0,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/posts\/7429\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/media\/9223372036854775807"}],"wp:attachment":[{"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/media?parent=7429"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/categories?post=7429"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/tags?post=7429"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}
\nefelix\/lua-cjson \u00b7 GitHub<\/a><\/p>\nmplua<\/span><\/h3>\n
\nnobu-k\/mplua \u00b7 GitHub<\/a><\/p>\n
\nmsgpack-0.5.7.tar.gz<\/a><\/p>\n\r\n.\/configure && make && make install\r\n<\/pre>\n
\r\n# mv \/msgpack.so \/usr\/lib64\/lua\/5.1\/\r\n# ln -snf \/usr\/local\/lib\/libmsgpack.so.3 \/usr\/lib64\/\r\n<\/pre>\n
\r\nlocal mp = require('msgpack')\r\nlocal packed = mp.pack({ hoge = 'aaa', foo = {1,2} })\r\nlocal unpacked = mp.unpack(packed)\r\n<\/pre>\n
\u611f\u60f3<\/span><\/h2>\n
\n\u30d0\u30a4\u30ca\u30ea\u30bb\u30fc\u30d5\u306e\u554f\u984c\u306f\u3001\u30e9\u30a4\u30d6\u30e9\u30ea\u5074\u3067\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u5bfe\u5fdc\u3055\u308c\u3066\u305f\u306e\u3067\u81ea\u5206\u304c\u8aac\u660e\u3092\u3061\u3083\u3093\u3068\u8aad\u3093\u3067\u3044\u306a\u304b\u3063\u305f\u306e\u3060\u554f\u984c\u3060\u3063\u305forz<\/p>\n
\n\u4e00\u90e8json\u30c7\u30b3\u30fc\u30c9\u3057\u3066\u3044\u308b\u90e8\u5206\u304c\u6b8b\u3063\u3066\u304a\u308a\u3001\u5168\u3066MessagePack\u306b\u5909\u66f4\u3057\u305f\u3068\u3053\u308d\u6700\u521d\u304b\u30893.6\u500d\u307e\u3067\u5411\u4e0a\u3057\u305f\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"