lua/js sync impl

This commit is contained in:
BADIM-PC\Vadim
2017-12-14 11:50:50 +03:00
parent 62a64515ef
commit 6e8a478ee9
6 changed files with 43 additions and 30 deletions

View File

@@ -748,11 +748,28 @@ static s32 lua_sync(lua_State* lua)
tic_mem* memory = (tic_mem*)getLuaMachine(lua);
bool toCart = true;
const char* section = NULL;
s32 bank = 0;
if(lua_gettop(lua) >= 1)
{
toCart = lua_toboolean(lua, 1);
memory->api.sync(memory, tic_bank_all, 0, toCart);
if(lua_gettop(lua) >= 2)
{
section = lua_tostring(lua, 2);
if(lua_gettop(lua) >= 3)
{
bank = getLuaNumber(lua, 3);
}
}
}
if(bank >= 0 && bank < TIC_BANKS)
memory->api.sync(memory, section, bank, toCart);
else
luaL_error(lua, "sync() error, invalid bank");
return 0;
}