lua-users home
lua-l archive

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


On Sat, Feb 22, 2014 at 2:01 PM, Francisco Olarte <folarte@peoplecall.com> wrote:
Hi:

On Sat, Feb 22, 2014 at 12:43 AM, Sean Conner <sean@conman.org> wrote:
>>     $ tclsh io.tcl
>>     11 helloworld
>>     11 helloworld
>>     11 helloworld
>>     $ lua io.lua
>>     15  hellohellohello
>
>   If the leading number is the number of characters in the string, then it
> looks like TCL is stripping out the NUL byte entirely, which, depending on
> how you look at it, is on par with the Lua version (wrong input) or worse
> (corrupted data).

Come on! He's guilty of not posting the code ( where I could easily
find it, because AFAIK he could be using getc() equivalents on ruby ).
I consider tcl version better or equal than lua.

If he is using gets, which discards the newline and seems the more
probable, he is reading hello=5+nul=1+world=5, if he is using another
function

If he is not and the count includes the newline, then TCL is getting
all the 'text file legal' chars plus the line count right, lua does
not get even the line count. In this case ( which I doubt is the one
happening ) they could be considered on par ( both wrong ) or better (
some things right ( text chars, line count ) in TCL nothing in lua ).
I do not see how it may be considered worst ( unless you argue the
more wrong the better as it is easier to spot ).

Apologies. I should have posted the code.  Here's a link to a Gist:

    https://gist.github.com/anonymous/9162419
 
The Tcl code uses gets which does not end-of-line character.