cocos2dx-lua读取json文件

cocos2d-x技术群新群:117871561
c++技术交流群:593010226

    local str = cc.FileUtils:getInstance():getStringFromFile("xxxx.json")
    local ok, datatable = pcall(function()
                   return cjson.decode(str)
                end)
    if true == ok and type(datatable) == "table" then
        dump(datatable, "文字", 6)
        --todo
    else
        --todo
    end

你可能感兴趣的:(cocos2dx-lua读取json文件)