From b2002199670ce2c2d0f3d55af603ee54190b9d67 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 20 Jul 2020 23:04:23 -0700 Subject: [PATCH] support for splitting lua scripts into parts without polluting the output of #DFHack ls --- docs/changelog.txt | 1 + library/Core.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index 5f3510ed9..c949115f1 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -56,6 +56,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## Lua - Added a ``ref_target`` field to primitive field references, corresponding to the ``ref-target`` XML attribute +- Support for splitting scripts into multiple files without polluting the output of '#DFHack ls'. Scripts that end in '-internal.lua' will not be listed, but but they can still be 'require'd from other scripts. ## Ruby - Updated ``item_find`` and ``building_find`` to use centralized logic that works on more screens diff --git a/library/Core.cpp b/library/Core.cpp index 20d9c994b..9192d5772 100644 --- a/library/Core.cpp +++ b/library/Core.cpp @@ -301,7 +301,7 @@ static void listScripts(PluginManager *plug_mgr, std::map &pset, path += '/'; for (size_t i = 0; i < files.size(); i++) { - if (hasEnding(files[i], ".lua")) + if (hasEnding(files[i], ".lua") && !hasEnding(files[i], "-internal.lua")) { string help = getScriptHelp(path + files[i], "--"); string key = prefix + files[i].substr(0, files[i].size()-4);