[NTG-context] io.readnumber / l-io.lua (with patch)

Philipp Gesang pgesang at ix.urz.uni-heidelberg.de
Mon Aug 30 14:11:55 CEST 2010


Hi, the function io.readnumber fails to call itself. I append a
patch. Philipp

-- 
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments
-------------- next part --------------
--- l-io.lua	2010-08-18 17:37:25.000000000 +0200
+++ /home/laokoon/versuche/lua/dok/examples/io/l-io.lua	2010-08-30 14:01:02.000000000 +0200
@@ -186,7 +186,7 @@
     end
 end
 
-function io.readnumber(f,n,m)
+local function readnumber(f,n,m)
     if m then
         f:seek("set",n)
         n = m
@@ -201,7 +201,7 @@
         return 256^3 * a + 256^2 * b + 256*c + d
     elseif n == 8 then
         local a, b = readnumber(f,4), readnumber(f,4)
-        return 256 * b + c
+        return 256 * a + b
     elseif n == 12 then
         local a, b, c = readnumber(f,4), readnumber(f,4), readnumber(f,4)
         return 256^2 * a + 256 * b + c
@@ -210,6 +210,8 @@
     end
 end
 
+io.readnumber = readnumber
+
 function io.readstring(f,n,m)
     if m then
         f:seek("set",n)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20100830/1808175e/attachment.pgp>


More information about the ntg-context mailing list