lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

we created a nice wee system for doing state machines in embedded systems with lua.

it even spat out GraphViz diagrams of the state machines automatically (not that we needed them but it was trivial to do given our lua implementation)

it meant you could interactively write software for embedded control systems.  Really nice.  Though it's shelved for the time being as productionising the electronics side of things needs to be done.



On Jan 12, 2008 1:26 PM, Jorge Visca <> wrote:
Duck wrote:
> Bear in mind (sorry, this doesn't actually answer your question, but
> is just an observation on a neat feature of Lua which you might not be
> aware of when creating state machine code) that Lua supports proper
> tail calls,
> meaning that if the value a function returns is computed _directly by
> calling another function_, that call (the tail call) is implemented as
> a jump, not as a call.
Yeah, i've noticed this reading the PiL on-line. I had to stop reading
it halfway because i was getting a "neat feature" overdose. As soon as i
get a feeling for closures and functions as first class values, i'll go
further. :)