From 33c0b31046a02bff85291af901634f7211c89be9 Mon Sep 17 00:00:00 2001 From: whosit Date: Sat, 5 Apr 2025 07:03:04 +0300 Subject: [PATCH] make output formatting more consistent --- init.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index b339386..c97e92f 100644 --- a/init.lua +++ b/init.lua @@ -372,8 +372,6 @@ core.register_chatcommand("eval", else last_coro_by_player[player_name] = nil end - - if ok then core.log("info", string.format("[cmd_eval][%s] succeeded.", cc)) else @@ -406,6 +404,7 @@ core.register_chatcommand("eval_resume", -- it's possible to send the string back to the coroutine through this local ok, res, raw = helper(coro, env, coroutine.resume(coro, param or "")) + res = string.gsub(res, "([^\n]+)", "| %1") coro_status = coroutine.status(coro) if coro_status == "suspended" then res = string.gsub(res, "([^\n]+)", "| %1") @@ -414,6 +413,8 @@ core.register_chatcommand("eval_resume", else res = res .. "\n* coroutine suspended, type /eval_resume to continue" end + else + last_coro_by_player[player_name] = nil end if ok then core.log("info", string.format("[cmd_eval][%s] succeeded.", coro_cc)) @@ -458,6 +459,7 @@ core.register_on_player_receive_fields( else ok, res, raw = helper(coro, env, coroutine.resume(coro)) end + res = string.gsub(res, "([^\n]+)", "| %1") coro_status = coroutine.status(coro) if coro_status == "suspended" then res = string.gsub(res, "([^\n]+)", "| %1") @@ -466,6 +468,8 @@ core.register_on_player_receive_fields( else res = res .. "\n* coroutine suspended, type /eval_resume to continue" end + else + last_coro_by_player[player_name] = nil end core.chat_send_player(player_name, res) if ok then