ShayF2 Posted February 11, 2019 Share Posted February 11, 2019 Who here has had a limitation with lua? A point where they wanted to do something and they couldn't with lua. Respond your limits, see how far you can really go. Link to comment
spenkbang Posted February 15, 2019 Share Posted February 15, 2019 A simple sleep() function that can accurately do less than 50ms (cant rely on counting frames or anything like that) I think something could be rigged up with coroutines and os.clock(), but I cant think of a way to condense it to where I just have to call the function once Link to comment
ShayF2 Posted February 16, 2019 Author Share Posted February 16, 2019 (edited) @spenkbang local seconds = 0 local timer = setTimer(function() seconds = seconds + 1 end, 1000, 0) function stopCount() killTimer(timer) return seconds end or you can try a loop function local seconds = 0 function startCount() seconds = seconds + 1 return continue() end function continue() seconds = seconds + 1 return startCount() end function stopCount() continue = function() end return seconds end Which can go less than 50 ms, this should be capable of getting close to 1ms Edited February 16, 2019 by ShayF Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now