在Lua中,可以使用"=="运算符来判断两个字符串是否相等。例如:
local str1 = "hello"
local str2 = "world"
if str1 == str2 then
print("字符串相等")
else
print("字符串不相等")
end
在这个示例中,由于str1和str2的值不相等,所以会输出"字符串不相等"。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
相关推荐:lua怎么判断字符串相等