Lua常用封裝方法

2022-04-21 18:43:11 字數 1110 閱讀 5357

--

獲取隨機值,指定上限和下限

function

getrandom(min,max)

--接收乙個整數n作為隨即序列的種子

math.randomseed(os.time

())

----然後不斷產生隨機數

--[[

for i=1, 5 do

print(math.random(100))

end]]--

return

math.random

(min,max)

end

function

getnow()

local nowtime = os.date("

%y-%m-%d %h:%m:%s

", os.time

())

--print(nowtime)

return

nowtime

endprint(os.time())

function

click(x,y)

if(x~= -1

and y~= -1) --

根據多點顏色區域模糊查色返回的結果

then

touchdown(x, y)

--點選事件

msleep(20

) touchup(x, y)

endmsleep(

1000

)end

改良

--

根據座標點選

function

click(x,y)

if(x~= -1

and y~= -1) --

根據多點顏色區域模糊查色返回的結果

then

touchdown(x, y)

--點選事件

msleep(getrandom(15,30

)) touchup(x, y)

endmsleep(getrandom(

1000,3000)) --

點選後等待一秒到三秒

end

lua常用方法收集

1.xlua之將c 集合轉換成table 將c 的list轉換成table local function convertcslisttotable list local t for i 0,list.count 1 dotable.insert t,list i endreturn t end 將c...

常用日期封裝方法

目錄 判斷時間是否在時間段內 判斷時間是否在時間段內 param nowtime 需要判斷的時間 param begintime param endtime return public static boolean belongcalendar date nowtime,date begintime...

php常用方法封裝

public function consumer request request elseif msg err else public function producer request request file name test.csv ob end clean header content t...