Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a strange behaviour #38

Open
rostok opened this issue Mar 1, 2025 · 0 comments
Open

a strange behaviour #38

rostok opened this issue Mar 1, 2025 · 0 comments

Comments

@rostok
Copy link

rostok commented Mar 1, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant