I am trying to save a table in a local file with the help of sys.save and a previuos mentioned module. My game is perfectly able to save and read the data from the file. But I want to be able to open and read the file without the game. Is there any way to save the tables human readable?
My table:
local M = {
player = {
playerID = 137610,
score = 30
}
}
return M
Saving files:
function saveScore(self)
if not sys.save("save.txt", shared_data) then
print("Gamedata not saved")
end
end
Loading files:
function loadScore(self)
local gamedata = sys.load("save.txt")
if not next(gamedata) then
pprint("Gamedata empty")
else
pprint(gamedata)
end
end
Debug output from defold console:
DEBUG:SCRIPT:
{ --[[000000003C269900]]
player = { --[[000000003C27C2F0]]
playerID = "137610",
score = 5
}
}
When I open up the file with other editors it looks like this:
HDTB player playerID 137610 score "@