Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

sleep(args) in lua
Started by tima.xxxyyy Aug 21 2019 06:08 AM

- - - - -
5 replies to this topic
function from_other_language
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

tima.xxxyyy

[GLOBAL: userInfoPane.html]
tima.xxxyyy
  • Observer

  • 6 posts
  • Corona SDK

I have a function:

local function lamp_tap(event)
--some code...
points_text.text = "all points: " .. points

--here I need sleep(or something like that) <<----- !!!!!!!!!

clear_lamps(6)--also functions
randomize(6)
--some code...
end

what I need: stop program for some time (so user can se the results) . I tried to find information in internet, but... something went wrong.



[TOPIC: post.html]
#2

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 892 posts
  • Corona SDK

Use timer.performWithDelay, or better yet, just make a button that the user needs to touch when they are ready and clear the display objects once the button is touched.


  • tima.xxxyyy likes this

[TOPIC: post.html]
#3

tima.xxxyyy

[GLOBAL: userInfoPane.html]
tima.xxxyyy
  • Observer

  • 6 posts
  • Corona SDK

I've heard about timer.performWithDelay(). And this thing is quite strange...



[TOPIC: post.html]
#4

tima.xxxyyy

[GLOBAL: userInfoPane.html]
tima.xxxyyy
  • Observer

  • 6 posts
  • Corona SDK

I need

local timer = require ("timer") 

?



[TOPIC: post.html]
#5

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 892 posts
  • Corona SDK

https://docs.coronalabs.com/api/library/timer/performWithDelay.html



[TOPIC: post.html]
#6

nick_sherman

[GLOBAL: userInfoPane.html]
nick_sherman
  • Corona Geek

  • 1,820 posts
  • Corona SDK

I need

local timer = require ("timer") 

?

 

Corona has a lot of extra 'global' methods you can call which you won't find in general Lua documentation. You need to study the Corona API docs to find out everything that is possible.

 

https://docs.coronalabs.com/api/library/index.html




[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: function, from_other_language