Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Lua 如何检查(&x2B;X)是否为最后一个文本_Lua - Fatal编程技术网

Lua 如何检查(&x2B;X)是否为最后一个文本

Lua 如何检查(&x2B;X)是否为最后一个文本,lua,Lua,我有以下代码: local text = 'CIA' if text == text..'+X' then print 'true' else print 'false' end 我想检查最后一个文本是否以(“+X”)结尾。函数提取一个子字符串。负指数从头到尾 if string.sub(text, -2) == '+X' then -- Ends with +X, do stuff accordingly. end 该函数提取一个子字符串。负指数从头到尾 if s

我有以下代码:

local text = 'CIA'
if text == text..'+X' then
    print 'true'
else
    print 'false'
end

我想检查最后一个文本是否以(“+X”)结尾。

函数提取一个子字符串。负指数从头到尾

if string.sub(text, -2) == '+X' then
     -- Ends with +X, do stuff accordingly.
end
该函数提取一个子字符串。负指数从头到尾

if string.sub(text, -2) == '+X' then
     -- Ends with +X, do stuff accordingly.
end

我要检查最后一个文本是否以('+X')结尾。我要检查最后一个文本是否以('+X')结尾。