lua-users home
lua-l archive

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


The string does not have any hole, the \0 is treated as any other character by lua.
It is only the (implicit) print statement in the interpreter that stops printing a string at the first encounter of a \0.

This has nothing at all to do with the length operator.

I feel this is worth pointing out:
> s="ab\0cd"
> =#s
5
> =s
ab

# applied to a string gives the highest valid index, ignoring any
"holes". The consistent thing to do would be to make it do the same
for tables.

--
Sent from my toaster.