Skip to content

Commit

Permalink
Make dfhack.run_command return the command_result value.
Browse files Browse the repository at this point in the history
Rename local variables to match dfhack.run_command_silent for clarity.
  • Loading branch information
BenLubar committed Jan 14, 2020
1 parent 47fa9e1 commit 96d8dff
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions library/lua/dfhack.lua
Original file line number Diff line number Diff line change
Expand Up @@ -765,14 +765,15 @@ function dfhack.run_command_silent(...)
end

function dfhack.run_command(...)
local output, status = _run_command(...)
for i, fragment in pairs(output) do
if type(fragment) == 'table' then
dfhack.color(fragment[1])
dfhack.print(fragment[2])
local result = _run_command(...)
for i, f in pairs(result) do
if type(f) == 'table' then
dfhack.color(f[1])
dfhack.print(f[2])
end
end
dfhack.color(COLOR_RESET)
return result.status
end

-- Per-save init file
Expand Down

0 comments on commit 96d8dff

Please sign in to comment.