diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-06-26 15:52:38 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-06-26 15:53:00 -0700 |
| commit | 65dc1f2196b46dbd527d49da113515bea825416d (patch) | |
| tree | 02dbbe6528dc9c4a1e71a522da624a08f1179d64 /files.lua | |
| parent | 42578872c72ec46b256a093f74482fb6e5b8e4b9 (diff) | |
Cleaning up metaprogramming a bit and fixing/adding test for recursion
control flow.
Diffstat (limited to 'files.lua')
| -rw-r--r-- | files.lua | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -161,4 +161,11 @@ files.get_line_number = function(str, pos) end return hi end +files.get_line = function(str, line_no) + local line_starts = files.get_line_starts(str) + return str:sub(line_starts[line_no] or 1, line_starts[line_no + 1] or -1) +end +files.get_lines = function(str) + return get_lines:match(str) +end return files |
