Skip to content

Commit

Permalink
Explain why string.len is used
Browse files Browse the repository at this point in the history
  • Loading branch information
luk3yx committed Sep 14, 2024
1 parent 4563382 commit 136f2b1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ local function naive_str_width(str)
local prev_w = 0
local line_count = 1
local i = 1
-- string.len() is used so that numbers are coerced to strings without any
-- extra checking
local str_length = strlen(str)
while i <= str_length do
local char = byte(str, i)
Expand Down

0 comments on commit 136f2b1

Please sign in to comment.