red-blox / zap

A lightning fast networking solution for roblox.
https://zap.redblox.dev
MIT License
89 stars 14 forks source link

[BUG] Maps with numeric keys drop non-sequential keys #112

Closed Ketasaja closed 2 months ago

Ketasaja commented 2 months ago

Reproduction

event test = {
    from: Server,
    type: Reliable,
    call: ManyAsync,
    data: map {[i32]: string}
}

Send this table:

{
    [1] = "1",
    [2] = "2",
    [50] = "50",
    [100] = "100",
}

Keys 50 and 100 will be dropped.

Expected behavior

Current behavior is consistent with Roblox's convention that an array is a table with a continuous sequence of integer keys beginning at 1. My Zap type is not string[] though, it's a map from i32. Expected behavior is for Zap to correctly serialize and deserialize what Roblox doesn't.