diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2023-11-18 12:21:30 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2023-11-18 12:21:30 -0800 |
commit | de66b015bcfbf4a995b25cc74c5f95d2362760a8 (patch) | |
tree | 2fb180163f064f2a2a2713012b26dcb9a1d74273 /source_file.lua | |
parent | a8dc0ee2be9ebbc55f40bbc12b591a6b2d4a0cfe (diff) | |
parent | 007b965b11b681550ee2e2244a2f53e64e88697d (diff) | |
download | view.love-de66b015bcfbf4a995b25cc74c5f95d2362760a8.tar.gz |
Merge lines.love
Diffstat (limited to 'source_file.lua')
-rw-r--r-- | source_file.lua | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/source_file.lua b/source_file.lua index dbb6f95..6d04f6b 100644 --- a/source_file.lua +++ b/source_file.lua @@ -63,7 +63,7 @@ function load_drawing(infile_next_line) local drawing = {mode='drawing', h=256/2, points={}, shapes={}, pending={}} while true do local line = infile_next_line() - assert(line) + assert(line, 'drawing in file is incomplete') if line == '```' then break end local shape = json.decode(line) if shape.mode == 'freehand' then @@ -88,8 +88,7 @@ function load_drawing(infile_next_line) elseif shape.mode == 'deleted' then -- ignore else - print(shape.mode) - assert(false) + assert(false, ('unknown drawing mode %s'):format(shape.mode)) end table.insert(drawing.shapes, shape) end @@ -123,8 +122,7 @@ function store_drawing(outfile, drawing) elseif shape.mode == 'deleted' then -- ignore else - print(shape.mode) - assert(false) + assert(false, ('unknown drawing mode %s'):format(shape.mode)) end end outfile:write('```\n') @@ -162,7 +160,7 @@ function load_drawing_from_array(iter, a, i) local line while true do i, line = iter(a, i) - assert(i) + assert(i, 'drawing in array is incomplete') --? print(i) if line == '```' then break end local shape = json.decode(line) @@ -188,8 +186,7 @@ function load_drawing_from_array(iter, a, i) elseif shape.mode == 'deleted' then -- ignore else - print(shape.mode) - assert(false) + assert(false, ('unknown drawing mode %s'):format(shape.mode)) end table.insert(drawing.shapes, shape) end |