lua-users home
lua-l archive

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


Roberto Ierusalimschy <roberto@inf.puc-rio.br>于2015年11月19日周四 下午9:49写道:
> The common mistake is use string.format to concat strings may contain zeros.
>
> Maybe supporting embedded zeros would be better ?

That is not trivial to implement. We would need to implement flag '-',
width, and "precision". I don't think it is worth the trouble, to
support something that, as you said, is a mistake.

Lua support embedded zero strings elsewhere, so this limit is a little strange :) 

Sometimes, string.format is more useful than string.pack . For example, to implement redis protocol ( http://redis.io/topics/protocol ) , it use a text protocol, but the string in the protocol may contain embedded zeros .