Last active
January 10, 2019 11:55
-
-
Save Srlion/c05782fceb7a5c4f0d03f7bc3622e559 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- af needs to be remade because string.Split is slow | |
GetCaretLine = function(s) | |
local caretPos = s:GetCaretPos() + 1 | |
local splittedText = s:GetText():Split("\n") | |
local len = 0 | |
for k, v in ipairs(splittedText) do | |
len = len + #v + 1 | |
if (caretPos <= len) then | |
return k | |
end | |
end | |
end | |
print(GetCaretLine(DTextEntry)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment