lua-users home
lua-l archive

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


It's not hard to just implement it yourself though

local bytes do
 function iter(str, pos)
  if pos <= #str then
   return pos+1, str:byte(pos, pos)
  end
 end
 function bytes(str)
  return iter, str, 1
 end
end

There, an iterator over all the bytes in a string and their corresponding position 😉