lua-users home
lua-l archive

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


	Hi Jacek,

On Fri, 31 Dec 2004, Jacek Czerwinski wrote:
> I look at CGI Lua,  specialy Lua Pages.
> Tell me - is this true, that teplating library has NOT a feature like:
>
> @foreach fruit (basket) { ${fruit} }.
	I'm not sure if I understand your code correctly.  Anyway,
I can say the preprocessing mechanism doesn't have a loop primitive
anymore (earlier versions do have), but with the current version you
can use Lua for that:

<table>
<?lua
	for fruit in pairs(basket) do
?>
  <tr><td><%= fruit %></td></tr>
<% end %>
</table>

	(I've mixed three ways of writting Lua code inside HTML:
<?lua code>, the primitive way; <%= expression >, which only accepts
expression, but produces output automatically; and <% code>, which is
the same as the first one)
	Inside test directory there is a set of testing files.
They are not provided neither as a sample collection nor as a
complete set of tests, but I think you could find something useful
there.

	Happy New Year,
		Tomas