Calculator Community > Lua

Is there any form of sleep or delay function?

(1/1)

Roondak:
I was wondering what the best way to delay the system would be. Would it be calling a timer and using that as your delay? Would it be putting the system in a while loop until timer.getMilliSecCounter() returns a certain value?

I was wondering how to do this to make text look as if it's being typed in, like in many RPG games.
EDIT: Got this working with timer, not sure if there's a better way to do this.

Streetwalrus:
I thought there was a function for that. Long time since I've done lua but I'm pretty sure lua itself brings sleep(time).

Jim Bauwens:
As TI-Nspire Lua framework is event based, it wouldn't be 'correct' to have blocking calls such as delay/sleep (hence they are not implemented). So your best bet would be using the timer and on.timer event (possibly in combination with timer.getMilliSecCounter, depending on what you have to do).

Navigation

[0] Message Index

Go to full version