summaryrefslogtreecommitdiff
path: root/img
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2022-08-05 16:52:56 +0100
committerubq323 <ubq323@ubq323.website>2022-08-05 16:52:56 +0100
commit2a14a8ba3d97562919f585383db0dc800636fe5a (patch)
treea4d7682cc96da2edda4a7da2845dececc6281760 /img
parent690fa76a7bc1fa87fecd186a3aca70a562c72b47 (diff)
fix whitespaceness
Diffstat (limited to 'img')
-rw-r--r--img/driver.lua3
-rw-r--r--img/load_pnm.lua4
2 files changed, 3 insertions, 4 deletions
diff --git a/img/driver.lua b/img/driver.lua
index 7756124..7a8aa53 100644
--- a/img/driver.lua
+++ b/img/driver.lua
@@ -4,13 +4,12 @@ local load_pnm = require("load_pnm").load
local shitty_disp = require("shitty_disp")
local perr = require("util").perr
-local file,err = io.open("/img/walter.pnm","rb")
+local file,err = io.open(arg[1],"rb")
perr(err,"io.open")
local ff = file:read("a")
local img = load_pnm(ff)
term.clear()
shitty_disp.disp(term.current(),img,1,1)
-os.sleep(1)
os.pullEvent("key")
shitty_disp.reset_palette(term.current())
diff --git a/img/load_pnm.lua b/img/load_pnm.lua
index 1fd4b70..af866ee 100644
--- a/img/load_pnm.lua
+++ b/img/load_pnm.lua
@@ -79,14 +79,14 @@ local function parse(imgf)
local has_depth = not(typech == 1 or typech == 4)
- local width,height,cur = imgf:match("%s*(%d+)%s*(%d+)%s*()",3)
+ local width,height,cur = imgf:match("\x0a(%d+) (%d+)\x0a()",3)
width,height = tonumber(width),tonumber(height)
assert(width,"couldn't find image dimensions")
-- by 'depth' i mean 'maximum value'
local depth = 1
if has_depth then
- local ndepth,ncur = imgf:match("(%d+)%s*()",cur)
+ local ndepth,ncur = imgf:match("(%d+)\x0a()",cur)
ndepth=tonumber(ndepth)
assert(ndepth,"couldn't find image depth (max pixel value), in a format that needs it")
depth=ndepth