Summary: Scripting: Can not save Player value into savegame
(Failed to dump variables)
Submitted by: englabenny
Submitted on: fredag 2010-03-12 den 13:37
Severity: 3 - Normal
Priority: 1 - Later
Assigned to: None
Discussion Lock: Any
Operating System: None
The Player value has no .id field anymore so it cannot be saved via the
script values scheme.
The Player "class" lost its 'id' field in Revision r14223
Attached scenario tries to store a player value in a global script variable.
It will print the error "lua error: Failed to dump variables" if you try to
save a savegame. However, the rest of the savegame seems to save intact so
freeciv does very well.
It looks like the only way to fix it is to re-add the 'id' field, since all
our types are supposed to have it, but I don't know what that technically
the alternative is an id() accessor and then special-casing Players in the
Discovered when updating
Script inside the savegame, with the output vars=$$:
function new_turn_callback(turn, year)
local player = find.player(0)
I_am_player = player
notify.all("Found player %s of the %s, now try save him/her into a
savefile", player.name, player.nation:plural_translation())
I_am_player = nil
The expected output in vars would be to somehow save the I_am_player
If there would have been more variables, all would be lost, not just the
Date: fredag 2010-03-12 den 13:37 Name: FailDumpPlayer.sav Size: 33 kB
Reply to this item at:
Meddelandet skickades via/av Gna!
Freeciv-dev mailing list