在Lua中,可以使用"=="運算符來判斷兩個字符串是否相等。例如:
local str1 = "hello" local str2 = "world" if str1 == str2 then print("字符串相等") else print("字符串不相等") end
在這個示例中,由于str1和str2的值不相等,所以會輸出"字符串不相等"。