Jump to content

Storing infinity in savedata


Recommended Posts

Since after all this time Klei hasn't addressed the issue of +-infinity not being savable, I wrote a patch of the game's saving system which allows saving these values.

I uploaded it as a sample mod, with all functionality in the savable_infinity.lua script, which may be modimport'ed by any mod in order to enable the saving extension.

Link to comment
Share on other sites

I can't understand why they haven't added support for this yet. If editing the dumper.lua file itself, this would be extremely simple. Just a matter of changing

    number = function(value) return value end,
to

    number = function(value)        if value == math.huge then            return "1/0"        elseif value == -math.huge then            return "-1/0"        elseif value ~= value then            return "0/0"        else            return value        end    end
and the third test (for NaN) is not even that important, since saving NaN is hardly useful (but it's nice to have it not corrupt savedata :razz:).
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...