How do I pause the program , continue running after waiting for a particular condition?

Corona uses a coordinated process, such as:

Function, ABC ()

Print (“first”)

End

Timer.performWithDelay (1000, ABC)

Print (“second”)

This code, the actual output of second before first, I want to delay 1 seconds to perform output first, then output second, waiting for 1 seconds when the program stops down, waiting for 1 seconds, 1 seconds after reading the print (“first”) and print (output first, read “second” the second corona API output), there are delay, but no one can delay some time to execute a code solution?

You pause the parts of your game you want paused individually.

There is no ‘traditional’ game loop in Corona so you can’t pause it.  You wouldn’t want to anyways.

https://docs.coronalabs.com/api/

Note: Your title uses the word pause, but it sounds more like you want to delay events/actions.

One way to create delays in otherwise linearly executing Lua code is with couroutines.

Starcrunch put out a module/library to make this easy.  I don’t have the original source, but I did integrate it into SSK2 (with credits).

However, I think with a little work you could work out how to do this on your own via the PIL 

https://www.lua.org/pil/9.html

Alternatively, you can use event driven coding.  Following code uses shorthand from SSK2 (I’m way too lazy to type it out longhand…blech!)

local stuff = {} stuff[#stuff+1] = "Hey" stuff[#stuff+1] = "You" stuff[#stuff+1] = "This" stuff[#stuff+1] = "Is" stuff[#stuff+1] = "Delayed" local count = 1 -- Custom event listener local function doit() if( count \> #stuff ) then return false end print( stuff[count] ) count = count + 1 end; listen( "onDoStuff", doit ) local function tap( event ) post( "onDoStuff" ) end; listen( "tap", tap )

Totally made up example, but the key element is the creation and listening for a custom Runtime (global) event.

Not strictly true…  most games simulate a game loop with an enterframe() event.  You should be able to suspend this to pause a game (physics, audio, transitions and timers will screw with this though). Coroutines are definitely out of scope for most devs"

If you want your code to work then you need to do this

Function, ABC ()   Print ("first") End timer.performWithDelay (1000, function()   ABC()   Print ("second") end)

@Ed I appreciate SSK2 may indeed help others but for a new user of Corona your code makes no sense if they don’t have your library installed and only seeks to confuse the OP even further.

Pausing complicated code in Corona is not an easy subject.

You pause the parts of your game you want paused individually.

There is no ‘traditional’ game loop in Corona so you can’t pause it.  You wouldn’t want to anyways.

https://docs.coronalabs.com/api/

Note: Your title uses the word pause, but it sounds more like you want to delay events/actions.

One way to create delays in otherwise linearly executing Lua code is with couroutines.

Starcrunch put out a module/library to make this easy.  I don’t have the original source, but I did integrate it into SSK2 (with credits).

However, I think with a little work you could work out how to do this on your own via the PIL 

https://www.lua.org/pil/9.html

Alternatively, you can use event driven coding.  Following code uses shorthand from SSK2 (I’m way too lazy to type it out longhand…blech!)

local stuff = {} stuff[#stuff+1] = "Hey" stuff[#stuff+1] = "You" stuff[#stuff+1] = "This" stuff[#stuff+1] = "Is" stuff[#stuff+1] = "Delayed" local count = 1 -- Custom event listener local function doit() if( count \> #stuff ) then return false end print( stuff[count] ) count = count + 1 end; listen( "onDoStuff", doit ) local function tap( event ) post( "onDoStuff" ) end; listen( "tap", tap )

Totally made up example, but the key element is the creation and listening for a custom Runtime (global) event.

Not strictly true…  most games simulate a game loop with an enterframe() event.  You should be able to suspend this to pause a game (physics, audio, transitions and timers will screw with this though). Coroutines are definitely out of scope for most devs"

If you want your code to work then you need to do this

Function, ABC ()   Print ("first") End timer.performWithDelay (1000, function()   ABC()   Print ("second") end)

@Ed I appreciate SSK2 may indeed help others but for a new user of Corona your code makes no sense if they don’t have your library installed and only seeks to confuse the OP even further.

Pausing complicated code in Corona is not an easy subject.