lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Javier Guerra wrote:
local count = 0
local offset = 0
while offset < strlength do
   assert (string.byte(s,offset+1) == 0x5A, 'no header')
   count = count+1
   local b2,b3 = string.byte (s, offset+2, offset+3)
   offset = offset + b2*256+b3
end

Looks quite similar to the code I posted 2 hours ago :), perhaps a bit neater. It'd be b3*256+b2 though I believe.

- Alex