Prevent debug mode from corrupting Lua's stack when sending sync table
This commit is contained in:
parent
9d51681d96
commit
1be5c3313b
|
@ -515,10 +515,8 @@ static void smlua_sync_table_send_table(u8 toLocalIndex) {
|
|||
// uses 'key' (at index -2) and 'value' (at index -1)
|
||||
|
||||
if (lua_type(L, -1) == LUA_TTABLE) {
|
||||
LOG_INFO(" sending sync table field (table): %s", lua_tostring(L, -2));
|
||||
smlua_sync_table_send_table(toLocalIndex);
|
||||
} else {
|
||||
LOG_INFO(" sending sync table field: %s", lua_tostring(L, -2));
|
||||
lua_pushvalue(L, tableIndex); // insert sync table
|
||||
lua_insert(L, -3); // re-order sync table
|
||||
smlua_sync_table_send_field(toLocalIndex, internalIndex, false);
|
||||
|
|
|
@ -120,9 +120,12 @@ void network_send_lua_sync_table(u8 toLocalIndex, u64 seq, u16 modRemoteIndex, u
|
|||
|
||||
packet_write(&p, &lntKeyCount, sizeof(u16));
|
||||
|
||||
//LOG_INFO("TX SYNC (%llu):", seq);
|
||||
for (int i = 0; i < lntKeyCount; i++) {
|
||||
if (!packet_write_lnt(&p, &lntKeys[i])) { return; }
|
||||
//LOG_INFO(" %s", smlua_lnt_to_str(&lntKeys[i]));
|
||||
}
|
||||
//LOG_INFO(" -> %s", smlua_lnt_to_str(lntValue));
|
||||
|
||||
if (!packet_write_lnt(&p, lntValue)) { return; }
|
||||
|
||||
|
@ -146,9 +149,13 @@ void network_receive_lua_sync_table(struct Packet* p) {
|
|||
packet_read(p, &modRemoteIndex, sizeof(u16));
|
||||
|
||||
packet_read(p, &lntKeyCount, sizeof(u16));
|
||||
|
||||
//LOG_INFO("RX SYNC (%llu):", seq);
|
||||
for (int i = 0; i < lntKeyCount; i++) {
|
||||
if (!packet_read_lnt(p, &lntKeys[i])) { goto cleanup; }
|
||||
//LOG_INFO(" %s", smlua_lnt_to_str(&lntKeys[i]));
|
||||
}
|
||||
//LOG_INFO(" -> %s", smlua_lnt_to_str(&lntValue));
|
||||
|
||||
if (!packet_read_lnt(p, &lntValue)) { goto cleanup; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue