lua-users home
lua-l archive

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




On Sun, Dec 21, 2008 at 3:53 PM, Sean Farrow <sean.farrow@seanfarrow.co.uk> wrote:
Hi:
if a string is empty, i.e "" can I compare it with nil?
Chers
Sean.

Use 'string.len()' to compare the size to 0.

example:
local str = ""
if str:len() == 0 then
    print( "The string is empty" )
else
    print( "The string has some content" )
end
--
Regards,
Ryan