Skip to content

Commit d62032e

Browse files
committed
Get dimensions of table outside of print_table()
1 parent 2532668 commit d62032e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

xtra/DIFF.LUA

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ local function diff_u(fn1,fn2)
1818
f:seek("set",o)local g=f:read(l)f:close()return g end
1919
local b1,e,b2=line(fn1,o1,l1)if not b1 then error(e)end b2,e=line(fn2,o2,l2)if not b2 then error(e)end
2020
return b1==b2 end
21+
local h,w=#f1//ps,#f2//ps
2122
local function print_table()
2223
--TODO: store and reverse lookup this table to find the least amount of changes
23-
local il,jl=#f1//ps,#f2//ps
24-
for i=1,il do
25-
local row={}for j=1,jl do table.insert(row,cmp(i,j)and"1"or"0")end
24+
for i=1,h do
25+
local row={}for j=1,w do table.insert(row,cmp(i,j)and"1"or"0")end
2626
print(table.concat(row," "))end end
2727
print_table()end
2828
if#arg<2 or#arg%2~=0 then print(arg[-1].." "..arg[0]..[[ old new...

0 commit comments

Comments
 (0)