lua-users home
lua-l archive

"strange" string comparison fallure

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


Hello,

Can someone explains to me why the following code is failling ?

----
function Command( topic, val )
print('cmd', topic, '"'..val..'"')
print(type(val))
if val == "Grab" then
print 'grab'
srf:Dump('/tmp', 'DashBoard')
else
print("different")
end
end
-----

The output is the follwing :

----
cmd HomeDashBoard/Tablette/Command "Grab"
string
different
----

As you can see the received string is Grab and is supposed to match the if statement ... but is not.

It's probably a stupid mistake ... but where ?

Thanks

Laurent

AltStyle によって変換されたページ (->オリジナル) /