Fix off-by-one error in `string:split` implementation.
authorDiego Martínez <kaeza@users.noreply.github.com>
Sun, 4 Jan 2015 23:10:25 +0000 (20:10 -0300)
committerkwolekr <kwolekr@minetest.net>
Mon, 5 Jan 2015 04:33:55 +0000 (23:33 -0500)
builtin/common/misc_helpers.lua

index 2ee990e5c0cdaa3b455cab746d01875b35cc03c4..a86631e1dc9b52c104d65881e5578def6ef14ab1 100644 (file)
@@ -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