Page 1 of 1

Is it possible to make a wait in Luna.Lua?

Posted: Tue Feb 07, 2017 2:54 pm
by BananaCat
There used to be a wait function in Lua, but I cant seen to find it, is it just regular wait(3)? Or.... :!:

Re: Is it possible to make a wait in Luna.Lua?

Posted: Tue Feb 07, 2017 4:27 pm
by Emral

Re: Is it possible to make a wait in Luna.Lua?

Posted: Tue Feb 07, 2017 4:28 pm
by Hoeloe
BananaCat wrote:There used to be a wait function in Lua, but I cant seen to find it, is it just regular wait(3)? Or.... :!:
You're probably thinking of Teascript-vb used by 38A. That is NOT Lua and has no relevance at all.

You can use the eventu library to make waits, though it's fairly advanced and I wouldn't recommend it to beginners.

Instead, you can construct a counter like this:

Code: Select all

local timerStart;

function onStart()
	timerStart = lunatime.tick(); --start the timer
end

function onTick()
	if(timerStart ~= nil and lunatime.tick() > timerStart+lunatime.toTicks(3)) then
		--timer is finished
		timerStart = nil;
	end
end
It's a little longer, but there's a lot more flexibility there. This is just one way to make a timer, there are a number of different possible ways.