Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/about/Authors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ DoctorVanGogh DoctorVanGogh
Donald Ruegsegger hashaash
doomchild doomchild
Droseran Droseran
dvantwisk dvantwisk
DwarvenM DwarvenM
Eamon Bode eamondo2 Baron Von Munchhausen
EarthPulseAcademy EarthPulseAcademy
Expand Down
1 change: 1 addition & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ Template for new versions:
## Fixes
- `preserve-rooms`: will no longer crash when a civzone is assigned to a unit that does not exist
- `gui/design`: fix misaligned shape icons
- `script-manager`: fix lua scripts in mods not being reloaded properly upon entering a saved world on Windows.

# 51.11-r1

Expand Down
10 changes: 6 additions & 4 deletions docs/dev/Lua API.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3338,12 +3338,14 @@ and are only documented here for completeness:

* ``dfhack.internal.findScript(name)``

Searches `script paths <script-paths>` for the script ``name`` and returns the
path of the first file found, or ``nil`` on failure.
Searches `script paths <script-paths>` for the script ``name`` (which
includes the ``.lua`` extension) and returns the absolute path of the first
file found, or ``nil`` on failure. Slashes in the path are canonicalized to
forward slashes.

.. note::
This requires an extension to be specified (``.lua`` or ``.rb``) - use
``dfhack.findScript()`` to include the ``.lua`` extension automatically.
You can use the ``dfhack.findScript()`` wrapper if you want to specify the
script name without the ``.lua`` extension.

* ``dfhack.internal.runCommand(command[, use_console])``

Expand Down
2 changes: 1 addition & 1 deletion library/LuaApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3965,7 +3965,7 @@ static int internal_findScript(lua_State *L)
const char *name = luaL_checkstring(L, 1);
std::filesystem::path path = Core::getInstance().findScript(name);
if (!path.empty())
lua_pushstring(L, path.string().c_str());
lua_pushstring(L, Filesystem::as_string(path).c_str());
else
lua_pushnil(L);
return 1;
Expand Down