summaryrefslogtreecommitdiff
path: root/img/driver.lua
blob: 065586c632a07acc656696cf6f92d68b7a6d8b48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package.path = "/?;/?.lua;"..package.path

_G.ERRLOG = {}
_G.oldprint = _G.print
_G.print = function(...)
	o = {}
	for ix = 1,select('#',...) do
		o[ix] = tostring(select(ix,...))
	end
	table.insert(_G.ERRLOG,table.concat(o,"\t"))
	_G.oldprint(...)
end
_G.rpr = function() _G.print = _G.oldprint end

print("uu")
local load_pnm = require("load_pnm").load
print("uu")
local better_disp = require("better_disp")
print("uu")
local disp_common = require("disp_common")
local perr = require("util").perr
print("uu")

local function msgh(e)
	local tb = debug.traceback()
	return e.."\n"..tb
end


local file,err = io.open(arg[1],"rb")
perr(err,"io.open")
local ff = file:read("a")
local img = load_pnm(ff)
local W = window.create(term.current(),20,10,20,20)
W.clear()
print("the")
print(xpcall(function() better_disp.disp(W,img,1,1) end,msgh))
print("endthe")
os.pullEvent("key")
disp_common.reset_palette(term.current())