Skip to content

Commit

Permalink
Fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
olanti-p committed Dec 7, 2022
1 parent ccc9687 commit 6554eac
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions data/mods/saveload_lua_test/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ local storage = game.mod_storage[ game.current_mod ]
--[[
If we keep all our data simple and in mod.storage,
we won't even have to register save/load hooks,
it'll be saved automatically.
it'll be saved/loaded automatically.
]]--
mod.storage = storage

--[[
If we have complex enough state (e.g. recursive tables, or with custom metatables)
we may create a hook that would write a simplified version into mod_storage,
so the hardcoded JSON serializer would be able to handle it.
If we want to build complex state out of loaded data
we may create a hook that would read loaded data from mod_storage
and create our complex state in the mod_runtime.
]]--
mod.on_game_load_hook = function()
log_info("SLT: on_load")
Expand All @@ -24,7 +24,7 @@ mod.on_game_load_hook = function()
if storage.tri then
log_info( "Data found! tri = ", storage.tri )
else
log_warn("Save/load of userdata is not implemnted!")
log_warn("Save/load of userdata is not implemented!")
if storage.tri_as_str then
log_info("Using HACK to load tri from string = ", storage.tri_as_str)
else
Expand All @@ -34,9 +34,9 @@ mod.on_game_load_hook = function()
end

--[[
If we want to build complex state out of loaded data
we may create a hook that would read loaded data from mod_storage
and create our complex state in the mod_runtime.
If we have complex enough state (e.g. recursive tables, or with custom metatables)
we may create a hook that would write a simplified version into mod_storage,
so the hardcoded JSON serializer would be able to handle it.
]]--
mod.on_game_save_hook = function()
log_info("SLT: on_save")
Expand All @@ -45,5 +45,5 @@ mod.on_game_save_hook = function()
-- Uncommenting this line will cause debugmsgs on save
--storage.tri = Tripoint.new(3, 4, 5)

storage.tri_as_str = tostring( storage.tri )
storage.tri_as_str = tostring( Tripoint.new(3, 4, 5) )
end

0 comments on commit 6554eac

Please sign in to comment.