about summary refs log tree commit diff stats
path: root/source_text.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2023-12-09 09:59:09 -0800
committerKartik K. Agaram <vc@akkartik.com>2023-12-09 09:59:09 -0800
commit67e3a43b523d1398dbfc5b2f9c4ab129921ee4bb (patch)
tree84f6590ea323103a4a5e8e1a5be5ceaf7a80aea8 /source_text.lua
parent17810bf7668124b3ecc3dc7b9b9bacef83216a83 (diff)
parent961f29613197bace7925d14f492114fea7b81214 (diff)
downloadtext.love-67e3a43b523d1398dbfc5b2f9c4ab129921ee4bb.tar.gz
Merge lines.love
Diffstat (limited to 'source_text.lua')
-rw-r--r--source_text.lua3
1 files changed, 1 insertions, 2 deletions
diff --git a/source_text.lua b/source_text.lua
index c28e203..dac2820 100644
--- a/source_text.lua
+++ b/source_text.lua
@@ -974,9 +974,8 @@ function Text.offset(s, pos1)
   if pos1 == 1 then return 1 end
   local result = utf8.offset(s, pos1)
   if result == nil then
-    print(pos1, #s, s)
+    assert(false, ('Text.offset(%d) called on a string of length %d (byte size %d); this is likely a failure to handle utf8\n\n^%s$\n'):format(pos1, utf8.len(s), #s, s))
   end
-  assert(result, "Text.offset returned nil; this is likely a failure to handle utf8")
   return result
 end