From a76bed0ed511848484bfeb0d3b94a0a8ac9af211 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Tue, 16 May 2023 11:41:28 -0700 Subject: [PATCH] rename overlay.reload to overlay.rescan --- docs/changelog.txt | 1 + docs/dev/overlay-dev-guide.rst | 4 ++-- plugins/lua/overlay.lua | 4 ++-- plugins/overlay.cpp | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index fc706cdba..4fab1aa28 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -54,6 +54,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## API ## Lua +- ``overlay.reload()``: has been renamed to ``overlay.rescan()`` so as not to conflict with the global ``reload()`` function. If you are developing an overlay, please take note of the new function name for reloading your overlay during development. ## Removed diff --git a/docs/dev/overlay-dev-guide.rst b/docs/dev/overlay-dev-guide.rst index 1a53e7f65..4ec226d30 100644 --- a/docs/dev/overlay-dev-guide.rst +++ b/docs/dev/overlay-dev-guide.rst @@ -183,7 +183,7 @@ Scripts #. If the script is not in your `script-paths`, install your script (see the `modding-guide` for help setting up a dev environment so that you don't need to reinstall your scripts after every edit). -#. Call ``:lua require('plugins.overlay').reload()`` to reload your overlay +#. Call ``:lua require('plugins.overlay').rescan()`` to reload your overlay widget Plugins @@ -194,7 +194,7 @@ Plugins :file:`hack/lua/plugins/` #. If you have changed the compiled plugin, `reload` it #. If you have changed the lua code, run ``:lua reload('plugins.mypluginname')`` -#. Call ``:lua require('plugins.overlay').reload()`` to reload your overlay +#. Call ``:lua require('plugins.overlay').rescan()`` to reload your overlay widget Troubleshooting diff --git a/plugins/lua/overlay.lua b/plugins/lua/overlay.lua index 84c2b4f96..9f41cb035 100644 --- a/plugins/lua/overlay.lua +++ b/plugins/lua/overlay.lua @@ -292,7 +292,7 @@ local function load_widgets(env_name, env) end -- called directly from cpp on plugin enable -function reload() +function rescan() reset() for _,plugin in ipairs(dfhack.internal.listPlugins()) do @@ -317,7 +317,7 @@ dfhack.onStateChange[GLOBAL_KEY] = function(sc) return end -- pick up widgets from active mods - reload() + rescan() end local function dump_widget_config(name, widget) diff --git a/plugins/overlay.cpp b/plugins/overlay.cpp index c02c960ba..784e17129 100644 --- a/plugins/overlay.cpp +++ b/plugins/overlay.cpp @@ -128,7 +128,7 @@ DFhackCExport command_result plugin_enable(color_ostream &out, bool enable) { if (enable) { screenSize = Screen::getWindowSize(); - call_overlay_lua(&out, "reload"); + call_overlay_lua(&out, "rescan"); } DEBUG(control).print("%sing interpose hooks\n", enable ? "enabl" : "disabl");