lua-users home
lua-l archive

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


> In the Lua Reference manual is written that format() can only be used 
> with strings that don't contain '\0'.
> For this reason, I use format("%s") to cut the characters following the 
> first '\0' from a string.

You should not do that. The meaning of "can only be used with strings that 
don't contain '\0'" is that you should not use it with strings that do 
contain '\0'... 

If you want to cut the characters following the first '\0' from a string,
you can use the following code:

  s = gsub(s, "%z.*$", "")

(I assume you want to cuts also the \0 itself...)

-- Roberto