diff --git a/defunityads/src/unityads_callback.cpp b/defunityads/src/unityads_callback.cpp index bd63001..1e411c8 100755 --- a/defunityads/src/unityads_callback.cpp +++ b/defunityads/src/unityads_callback.cpp @@ -35,34 +35,9 @@ namespace dmUnityAds { } lua_pushnumber(L, type); - bool is_fail = false; - dmJson::Document doc; - dmJson::Result r = dmJson::Parse(json, &doc); - if (r == dmJson::RESULT_OK && doc.m_NodeCount > 0) - { - char error_str_out[128]; - if (dmScript::JsonToLua(L, &doc, 0, error_str_out, sizeof(error_str_out)) < 0) - { - dmLogError("Failed converting object JSON to Lua; %s", error_str_out); - is_fail = true; - } - } - else - { - dmLogError("Failed to parse JSON object(%d): (%s)", r, json); - is_fail = true; - } - dmJson::Free(&doc); - if (is_fail) - { - lua_pop(L, 2); - assert(top == lua_gettop(L)); - return; - } - - int number_of_arguments = 3; + dmScript::JsonToLua(L, json, strlen(json)); // throws lua error if it fails - int ret = dmScript::PCall(L, number_of_arguments, 0); + int ret = dmScript::PCall(L, 3, 0); (void)ret; dmScript::TeardownCallback(m_luaCallback);