But the data is not saved/restored. I then added echos to see what happens and they do not seem to be called at all (not echo entries in the infolog). The script itself seems to run without errors.
Do Set/GetConfigData not work in gadgets? Or I am doing sth. wrong? I just added the code below to the unsynced part of the gadget, in which kothposx and kothposy are local variables giving the position of the window.
Where should the data be stored? I didn't find any entry of my data in the mod config file (in luaui/config); which is not very surprising since the function do not seem to be called
I would appreciate any tips, since I am running out of ideas.
Code: Select all
function widget:GetConfigData()
--Spring.Echo("Widget KotH: Saving config data: kothposx = " .. kothposx .. " / kothposx = " .. kothposy )
local data = {}
data.koth={}
data.koth.kothposx = kothposx
data.koth.kothposy = kothposy
return data
end
function widget:SetConfigData(data)
--Spring.Echo("Widget KotH: Loading config data ..." )
if (data.koth ~= nil) then
if ( data.koth.kothposx ~= nil ) then
kothposx = data.koth.kothposx
end
if ( data.koth.kothposy ~= nil ) then
kothposy = data.koth.kothposy
end
else
--Spring.Echo("Widget KotH: Config data was nil ..." )
end
end