Lua中usleep的语法代码是什么?

时间:2014-11-22 07:55:22

标签: lua

我想在我的代码中放入一些睡眠,但我不知道正确的语法。我想把它放在TouchMove里面,这样在移动到另一个像素之前,像素的每次移动都会有一定数量的睡眠。

--this program will pick random spots for x,y and will slide down 5 pixels

--define section
local iX
local iY
local iLoop

--initialize variables
--randomize variables
iX=40
iY=math.random(100,150)


--touchdown finger
--execute move for touchup

print("TouchDown ".. "(" .. iX .. "," .. iY .. ")" )

--touchmove finger
--slide down 5 pixels

for iLoop = 1,5 do
  --compute for next pixel
  iX= iX - 1

  --execute move for touchmove
  print("TouchMove ".. "(" .. iX..","..iY .. ")" )
end



--pick up finger

--execute move for touchup

print("TouchUp " .. "(" .. iX .. "," .. iY .. ")" )