From c25e8d4c270f681d0c2f92e8c192fda4f31594a2 Mon Sep 17 00:00:00 2001 From: duncathan Date: Tue, 11 Jan 2022 20:17:00 -0600 Subject: [PATCH] better error messages for failures in tsc_file.lua --- caver/tsc_file.lua | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/caver/tsc_file.lua b/caver/tsc_file.lua index 4bd1abb..7df9551 100644 --- a/caver/tsc_file.lua +++ b/caver/tsc_file.lua @@ -10,20 +10,20 @@ end function TscFile:placeScriptAtEvent(script, event, mapname, needle) needle = needle or " pEnd then -- This is totally normal and can be ignored. - -- print(('Found "%s", but was outside of label.'):format(needle, replacement)) - return text, false + local err = ('Found "%s", but was outside of label (%d, %d) at index %d.'):format(needle, pStart, pEnd, i) + return text, err end -- find the earliest occurence of an override @@ -69,7 +69,7 @@ function TscFile:_stringReplace(text, needle, replacement, label, overrides) assert((j % 1 == 0), tostring(j)) local a = text:sub(1, i - 1) local b = text:sub(j + 1) - return a .. replacement .. b, true + return a .. replacement .. b, nil end function TscFile:_getLabelPositionRange(label)