diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2023-04-02 09:31:56 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2023-04-02 09:31:56 -0700 |
commit | 24a48e665ff381b0c134fe7c834b5476686b441e (patch) | |
tree | fd196e4a6bc430a46e67e4c3573842bd2b284834 /source_file.lua | |
parent | 1330e4b9168e07b629a47dec436dec2484686db7 (diff) | |
parent | 3547c18db6b9d508fb5c2399c124e33f4cc8c488 (diff) | |
download | view.love-24a48e665ff381b0c134fe7c834b5476686b441e.tar.gz |
Merge text.love
Diffstat (limited to 'source_file.lua')
-rw-r--r-- | source_file.lua | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/source_file.lua b/source_file.lua index 194ef9b..3adab1f 100644 --- a/source_file.lua +++ b/source_file.lua @@ -1,7 +1,5 @@ -- primitives for saving to file and loading from file -Fold = '\x1e' -- ASCII RS (record separator) - function file_exists(filename) local infile = App.open_for_reading(filename) if infile then @@ -28,13 +26,7 @@ function load_from_file(infile) if line == '```lines' then -- inflexible with whitespace since these files are always autogenerated table.insert(result, load_drawing(infile_next_line)) else - local line_info = {mode='text'} - if line:find(Fold) then - _, _, line_info.data, line_info.dataB = line:find('([^'..Fold..']*)'..Fold..'([^'..Fold..']*)') - else - line_info.data = line - end - table.insert(result, line_info) + table.insert(result, {mode='text', data=line}) end end end @@ -54,10 +46,6 @@ function save_to_disk(State) store_drawing(outfile, line) else outfile:write(line.data) - if line.dataB and #line.dataB > 0 then - outfile:write(Fold) - outfile:write(line.dataB) - end outfile:write('\n') end end @@ -147,11 +135,7 @@ function load_array(a) else --? print('inserting text') local line_info = {mode='text'} - if line:find(Fold) then - _, _, line_info.data, line_info.dataB = line:find('([^'..Fold..']*)'..Fold..'([^'..Fold..']*)') - else - line_info.data = line - end + line_info.data = line table.insert(result, line_info) end end |