Lua math.random在坐标上

Lua math.random在坐标上,lua,autotouch,Lua,Autotouch,我试图检查屏幕上的颜色,如果颜色返回我预定的字符串,那么我想点击在程序开始时设置的变量 math.randomseed(os.time()) xvar = (math.random(100) + 300) yvar = (math.random(100) + 560) touch = function() local color = getColor(300,560) if color == 16711422 then tap(xvar ..','.. yvar) else usleep(5

我试图检查屏幕上的颜色,如果颜色返回我预定的字符串,那么我想点击在程序开始时设置的变量

math.randomseed(os.time())
xvar = (math.random(100) + 300)
yvar = (math.random(100) + 560)

touch = function()
local color = getColor(300,560)
if color == 16711422 then
tap(xvar ..','.. yvar)
else 
usleep(5000000)
collectgarbage()
touch()
end
end

touch()
当我在颜色应该是的地方运行此命令时,我收到一个警报:

/Applications/AutoTouch.app/Extensions.lua:105:错误参数#2到“触地”(需要数字,得到字符串)

我知道我的语言是粗制滥造的,我还在学习印刷品。有时我的很多错误都是直接来自于无效的结构

正确的代码为抽头(x,y)。
我只是假设可以输入前面提到的全局变量。

我假设您正在使用提供的代码实现
tap
。在这种情况下,
tap
是一个函数,它接受两个数值参数—要点击位置的X坐标和Y坐标。传递一个字符串,它是X坐标、逗号和Y坐标的串联


tap(xvar..,“…yvar)
更改为
tap(xvar,yvar)

是的,在通过帮助进行了一些梳理之后,我了解到使用引号只会告诉程序将其作为文本阅读。但在代码中,我想逗号并不是真正的逗号。第一次学习时可能很难理解。但这起作用了,谢谢!