Yuck. This one is messy. Your code was doing something wrong... or, more properly, something a little too clever for DSB. It was a condition that I did not at all anticipate so DSB had no error checking and simply crashed.
You store direct table references to archetypes (rather than just a string naming it) which in theory works fine. However, the problem is, when these tables are stored in exvars, DSB tries to serialize them when you save the game, and its serialization code is not all that smart. It has no idea this is a link to something in
obj, so it simply blindly serializes the entire table, including all sorts of internal data that will certainly not be valid when you reload... so, when you do reload, everything explodes.
I've changed it to throw a Lua error if
dsb_qswap (or any other function requiring an arch) is passed anything other than a string, which eliminates the problem. The key in
obj for a valid arch is stored in
arch.ARCH_NAME, that is,
arch ==
obj[arch.ARCH_NAME], so changing things to use strings should hopefully not be
too painful. The current save file is still going to have errors, because it has some invalid tables saved in it, but I've at least updated it so DSB will just throw Lua errors instead of segfaulting if it encounters something that looks like an arch table but turns out not to be.
Here's a
DSB 0.66c exe, fixing both this bug and the
RNG bug.
By the way, thanks for all your help with debugging! Being a one-person project, DSB often doesn't get enough (or any...) real testing.