From 00bca11f5988cfe7ce019c15c056ae258c254023 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Diego=20Mart=C3=ADnez?= <kaeza@users.noreply.github.com>
Date: Sun, 4 Jan 2015 20:10:25 -0300
Subject: [PATCH] Fix off-by-one error in `string:split` implementation.

---
 builtin/common/misc_helpers.lua | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/common/misc_helpers.lua b/builtin/common/misc_helpers.lua
index 2ee990e5c..a86631e1d 100644
--- a/builtin/common/misc_helpers.lua
+++ b/builtin/common/misc_helpers.lua
@@ -178,7 +178,7 @@ function string.split(str, delim, include_empty, max_splits, sep_is_pattern)
 			table_insert(items, s)
 		end
 		pos = npe + 1
-	until (max_splits == 0) or (pos > len)
+	until (max_splits == 0) or (pos > (len + 1))
 	return items
 end
 
-- 
GitLab