theonlysnowflake Posted December 15, 2015 Share Posted December 15, 2015 Is there a way to do a thread.sleep function like in java, but in lua? I am making a piston-like function based off the sliding door function where it pushes out, then waits for a set amount of time, then falls back in. I had it as time:Delay(1000) but that would pause the game and I didn't want that. Any help? Quote Link to comment Share on other sites More sharing options...
shadmar Posted December 15, 2015 Share Posted December 15, 2015 Maybe this will help: http://www.leadwerks.com/werkspace/topic/13593-using-a-timer/#entry95170 1 Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
Rick Posted December 15, 2015 Share Posted December 15, 2015 I assume you have an entity script attached to this piston entity? If so then you can handle the states of the piston inside the UpdateWorld() function. By this I mean you can determine if you have to wait and if so you do some timer logic to wait. if state == "waiting" then if Time:GetCurrent() >= self.lastTime + self.interval then state = "fall_back" end end Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.