From 950d9513996a07bdb35c8ea933a7ea54c5ba03af Mon Sep 17 00:00:00 2001 From: Squid Coder <92821989+realSquidCoder@users.noreply.github.com> Date: Wed, 15 Jan 2025 15:51:18 -0600 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Myk --- docs/dev/Lua API.rst | 4 ++-- library/LuaApi.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/dev/Lua API.rst b/docs/dev/Lua API.rst index f57409b39f..bfadfc6899 100644 --- a/docs/dev/Lua API.rst +++ b/docs/dev/Lua API.rst @@ -771,9 +771,9 @@ arbitrary Lua tables. Same semantics as for the ``Site`` functions, but will associated the data with the global world context. -* ``dfhack.persistent.getUnsavedSecs()`` +* ``dfhack.persistent.getUnsavedSeconds()`` - Returns the number of seconds since last save or load of a save + Returns the number of seconds since last save or load of a save. The data is kept in memory, so no I/O occurs when getting or saving keys. It is all written to a json file in the game save directory when the game is saved. diff --git a/library/LuaApi.cpp b/library/LuaApi.cpp index 1b357dcef3..edadc552e9 100644 --- a/library/LuaApi.cpp +++ b/library/LuaApi.cpp @@ -353,7 +353,7 @@ static int dfhack_persistent_delete_world_data(lua_State *L) { return delete_site_data(L, get_world_data); } -static int dfhack_persistent_get_last_save_time(lua_State *L) { +static int dfhack_persistent_get_unsaved_seconds(lua_State *L) { lua_pushinteger(L, Persistence::getUnsavedSeconds()); return 1; } @@ -365,7 +365,7 @@ static const luaL_Reg dfhack_persistent_funcs[] = { { "getWorldDataString", dfhack_persistent_get_world_data_string }, { "saveWorldDataString", dfhack_persistent_save_world_data_string }, { "deleteWorldData", dfhack_persistent_delete_world_data }, - { "getUnsavedSeconds", dfhack_persistent_get_last_save_time }, + { "getUnsavedSeconds", dfhack_persistent_get_unsaved_seconds }, { NULL, NULL } };