Skip to content

Commit

Permalink
Merge pull request #3 from defold/dev-defold-1-4-0
Browse files Browse the repository at this point in the history
Update to new json to Lua decoder
  • Loading branch information
britzl committed Nov 2, 2022
2 parents c7a546d + 1c44a8b commit 44c6944
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions webmonetization/src/webmonetization.cpp
Expand Up @@ -53,23 +53,8 @@ static void WebMonetization_OnEventListener(const char* event, const char* detai

lua_pushstring(L, event);

dmJson::Document json;
dmJson::Result r = dmJson::Parse(details, &json);
if (r != dmJson::RESULT_OK)
{
dmLogError("Unable to parse monetization details");
lua_pushnil(L);
}
else
{
char err_str[128];
int convert_r = dmScript::JsonToLua(L, &json, 0, err_str, sizeof(err_str));
if (convert_r < 0)
{
dmLogError("Unable to parse monetization details");
}
dmJson::Free(&json);
}

dmScript::JsonToLua(L, details, strlen(details)); // throws lua error if it fails

dmScript::PCall(L, 3, 0);

Expand Down

0 comments on commit 44c6944

Please sign in to comment.