lua-users home
lua-l archive

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


On 11/03/2014 19.14, meino.cramer@gmx.de wrote:
There are either a one character or a two character or a three
character code at the beginning of each line, which tells me about
the kind of data to expect after that code.

P.S. In that case I adapt my previous suggestion: you could use string.byte(s) to get the code of the first character, then (if needed) string.byte(s, 2) for the second and string.byte (s, 3) for the third one.

Also, using a local will save table accesses:

  local charcode = string.byte

I am currently squeezing out the last CPU cycles from an 8-bit MCU, so I am in the right mood for optimization, even if probably unneeded ;-)

--
  Enrico