I added some comments and logs. Normally, the campaign data file should be in "~/.widelands/campaigns/campaign_name/scenario_name.wcd". I believe the error may be caused by Section::has_val(). The Profile class is used in many places but the has_val() function was unused until now. I´m unable to run with ASAN for some reason, it compiles fine but I get this error on startup: ==25087==ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD. Can you please trigger the error again with the additional logs and provide the output, and possibly the contents of the .wcd file (if it exists)?
The easiest way to test is to put the following code in the scripting/init.lua for any map, and load it as a singleplayer scenario: include "scripting/coroutine.lua" function thread() game = wl.Game () save() read() end function save() print("Starting to WRITE...") game:save_campaign_data("test_campaign", "test_scenario", { x = 5, y = "Hello", z = { nil, 10, 12, 14, 16, "A", "B", "C", { a = 1, b = 2, }, "D", } }) print("Done.") end function print_table(t, depth) print(string.rep(" ", depth - 1) .. "#=" .. #t) for k,v in pairs(t) do local string = string.rep(" ", depth) .. k .. "=" if v == nil then print ( string .. "nil" ) elseif type(v) == "table" then print ( string .. "{" ) print_table(v, depth + 2) print (string.rep(" ", depth) .. "}") elseif type(v) == "boolean" then if v then print ( string .. "true" ) else print ( string .. "false" ) end else print ( string .. v ) end end end function read() print("Starting to READ...") local result = game:read_campaign_data("test_campaign", "test_scenario") print("Returned:") if result == nil then print (" <nil>") else print_table(result, 2) end print("Done.") end run(thread) This saves a campaign data file, then reads it and prints the result to stdout. You can then compare the init.lua, the wcd file and the output. Without ASAN, this works fine for me. -- https://code.launchpad.net/~widelands-dev/widelands/campaign_data/+merge/343783 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/campaign_data. _______________________________________________ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp