lua-users home
lua-l archive

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

On Tue, Feb 8, 2011 at 1:03 PM, Marc Simpson <> wrote:
> The templating engine is trivial at present, though I envisage (as with
> Dancer) the ability to drop in a third party implementation.

While we're talking about template engines, there's a little piece of
code by Rici Lake which is astounding for its power/weight ratio:

I pulled it out in slightly modified form as:

(It's not often that such functionality can fit into the conventional
size of a snippet!)

The cool thing is that Lua code and HTML (or anything) can be freely mixed

# for i = 1,10 do
   <ld>$('Hello '..i)</ld>
# end

Only two rules (a) lines starting with # are Lua and (b) otherwise Lua
expressions can occur in $(...)

The code is well worth studying for the 'aha!' moment.

steve d.