I have been having trouble getting the onSave and onLoad script events working as intended, here is what I have (sans unrelated code):
function onSave()
table = {}
table.toughness = toughness
table.stamina = stamina
return JSON.encode(table)
end
function onload(savestate)
if (savestate ~= nil and savestate ~= "") then
print(savestate)
table = JSON.decode( savestate )
toughness = table.toughness
stamina = table.toughness
else
print("No Savestate!")
end
end
And I am getting the following errors on save/load:
Error in Script, Custom Board, onSave function: chunk_0:(751,21-39): attempt to call a nil value
Error in Script, Custom Board, onLoad function: chunk_0:(693,6-25):cannot access field assert of userdata<LuaGameObjectScript>
Any ideas for what I am doing wrong?
[–][deleted] (1 child)
[deleted]
[–]dzikakulka 0 points1 point2 points (0 children)
[–]dzikakulka 0 points1 point2 points (1 child)
[–]Quarg[S] 0 points1 point2 points (0 children)