Omnimaga

Calculator Community => TI Calculators => Lua => Topic started by: Roondak on March 24, 2014, 10:15:05 pm

Title: Is there any form of sleep or delay function?
Post by: Roondak on March 24, 2014, 10:15:05 pm
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.
Title: Re: Is there any form of sleep or delay function?
Post by: Streetwalrus on March 25, 2014, 02:16:19 am
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).
Title: Re: Is there any form of sleep or delay function?
Post by: Jim Bauwens on March 25, 2014, 04:54:37 am
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).