lua-users home
lua-l archive

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


	Hi Gary

> I am wondering if is possible to loop in lua page in a
> more "declarative" way as in 
> 
> http://kid-templating.org/language.html
	There is a study to use some concepts of StringTemplate
in Lua (I can find a reference to it if you want).  IMHO, it is
much better than the original one :-)

> That is instead of :
> 
> <?lua
> for i=1,10 do
>   cgilua.put(string.format("<p>%s</p>"), tostring(i))
> end
> ?>
> 
> but something like(completely made up syntax):
> 
> <p <?= loop(10) ?>> <?= item ?> </p>
	You could do something like:

<?lua
for i=1,10 do
?>
<p><%= tostring(i) %></p>
<?lua
end
?>

	Verbose isn't it?  With LuaST it would be in just one line!

	Regards,
		Tomás