From 72e9e449a0adbbd6cd47b5a40e89698a1a3217ed Mon Sep 17 00:00:00 2001 From: "BADIM-PC\\Vadim" Date: Tue, 21 Nov 2017 20:10:51 +0300 Subject: [PATCH] sync() api changes #410 --- src/jsapi.c | 4 +++- src/luaapi.c | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/jsapi.c b/src/jsapi.c index 91b3d32..768c4dc 100644 --- a/src/jsapi.c +++ b/src/jsapi.c @@ -703,7 +703,9 @@ static duk_ret_t duk_sync(duk_context* duk) { tic_mem* memory = (tic_mem*)getDukMachine(duk); - memory->api.sync(memory, true); + bool toCart = duk_is_null_or_undefined(duk, 0) ? true : duk_to_boolean(duk, 0); + + memory->api.sync(memory, toCart); return 0; } diff --git a/src/luaapi.c b/src/luaapi.c index a60782f..2dd9168 100644 --- a/src/luaapi.c +++ b/src/luaapi.c @@ -745,7 +745,12 @@ static s32 lua_sync(lua_State* lua) { tic_mem* memory = (tic_mem*)getLuaMachine(lua); - memory->api.sync(memory, true); + bool toCart = true; + + if(lua_gettop(lua) >= 1) + toCart = lua_toboolean(lua, 1); + + memory->api.sync(memory, toCart); return 0; }