Fix bug when trying to delete a char of an empty string
This commit is contained in:
parent
2ae96a5950
commit
1f0c54afc7
1 changed files with 1 additions and 1 deletions
|
@ -5,7 +5,7 @@ local core = require(BASE .. 'core')
|
||||||
local utf8 = require 'utf8'
|
local utf8 = require 'utf8'
|
||||||
|
|
||||||
local function split(str, pos)
|
local function split(str, pos)
|
||||||
local offset = utf8.offset(str, pos)
|
local offset = utf8.offset(str, pos) or 0
|
||||||
return str:sub(1, offset-1), str:sub(offset)
|
return str:sub(1, offset-1), str:sub(offset)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue