Skip to content

a strange behaviour #38

@rostok

Description

@rostok

I am saving my game state into structure
local saveData = { game = game:serializeTab(), view = view:serializeTab(), actors = {} }
then actors table is filled in a loop using table.insert()

It seems then actors table, being pure integer based, continous array should be iterable using both pairs and ipairs.

However after I use bitser.loads() I encounter non deterministic errors when iterating over this unserialized table using pairs(). For some reason values are sometimes duplicated with same data and different table addresses. The solution here is to iterate over actors with ipairs. This way no duplicated values are found.

Frankly I don't know if bitser is to blame. I have added duplicate checks right after unserialization and even after duplicates are found to check table integrity. Both to no avail. So my only suspicion is that the deserialized table is somehow faulty.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions