Page 1 of 1

Lua 101

Posted: Wed Jun 17, 2009 11:04 pm
by MickCrozier
I found this very helpful for getting me started with the basic syntax of Lua - ... ler_9.html


Re: Lua 101

Posted: Wed Aug 26, 2009 4:36 pm
by BobbyHarrell
thanks for this.

Re: Lua 101

Posted: Fri Dec 18, 2009 9:24 am
by tom
Thanks for the link, it was helpful.

A couple of uneducated questions -
What is the lifespan of a lua variable? They seem to live longer than just the script they are used in. They can also be used by other scripts right?

Do you have to pay attention to killing them off?
They dont survive between session? Will restarting the software clean them all out?

Is there any type of timer or count function? Like wait(some amount of miliseconds)

Re: Lua 101

Posted: Fri Dec 18, 2009 11:15 am
by BrianEvans
Lua variables that are not local, live your entire palette session.

Variables do not get wiped until you close Palette,
and re-open.

Timer is something I wanted a while ago as well,
it was attempted in the engine,
but found to be dangerous and costly in the current architecture.
Major re-work was found to be required.
(Was pausing the entire UI).
(Behaved Like Loop / Do GetTickCount in VB.)

Re: Lua 101

Posted: Fri Dec 18, 2009 10:43 pm
by RobertBell
HC.VariableSetDelayed('page','name' | order,'value' | value,seconds)
Often works good enough - but means you have to split the code in 2 (pre and post branch)