Function 如何在corona中使用此功能重置游戏? 好吧,我在科罗纳有一个这样的游戏: 游戏()

Function 如何在corona中使用此功能重置游戏? 好吧,我在科罗纳有一个这样的游戏: 游戏(),function,lua,coronasdk,Function,Lua,Coronasdk,基本上,在reset函数中,我再次调用game()函数。 但是由于这个原因,在几次重置之后,游戏变得很慢,我认为这是因为所有的功能都被推到了另一个上面,没有功能“返回”。那么,有什么办法可以解决我想做的事情,但又不影响比赛? 谢谢这样做比较容易。从变量和第一个函数中删除局部变量(如果出现错误) local function game() //game is here which contains mainly display objects end local function reset(

基本上,在reset函数中,我再次调用game()函数。 但是由于这个原因,在几次重置之后,游戏变得很慢,我认为这是因为所有的功能都被推到了另一个上面,没有功能“返回”。那么,有什么办法可以解决我想做的事情,但又不影响比赛?
谢谢

这样做比较容易。从变量和第一个函数中删除局部变量(如果出现错误)

local function game()
//game is here which contains mainly display objects

end

local function reset()
   //here i remove all the display objects and cancel timers
  //and then call the game function again
  game()
end
local function game()
//game is here which contains mainly display objects

end

local function reset()
   //here i remove all the display objects and cancel timers
  //and then call the game function again
  game()
end