Lua if 返回 false 但应该返回 true

我有这段代码

 for i=1, #result, 1 do

            local vehicleProps = json.decode(result[i].vehicle)
            print(vehicleProps.plate)
            print(plate)

            if vehicleProps.plate == plate then
                found = true
                print(found)
                break
            end
            print(found)

        end

我对 Lua 还比较新,但它非常简单,为什么当 vehicleProps.plate 等于 plate 时,代码返回 false? 是否有任何方法可以检查两个值是否相同? 任何类型的帮助都将不胜感激。

用户 hjpotter92 的输出为:

2162899082 417849 string string false
QBW 339 417849 string string false
27538 417849 string string false
UCF 804 417849 string string false
417849 417849 string string false
65507 417849 string string false
864539 417849 string string false
9703143430 417849 string string false
点赞
用户5504872
用户5504872
function all_trim(s)
    return s:match("^%s*(.-)%s*$")
end

if all_trim(vehicleProps.plate) == all_trim(plate) then

将代码改为如下形式, 看起来确实有一个空格,谢谢大家的帮助。

2019-01-30 23:21:40