comparison website/src/examples/hi2.luan @ 505:7bc63886d4f2

web page modules now return a function
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 21 May 2015 01:45:49 -0600
parents 92c3d22745b8
children ca169567ce07
comparison
equal deleted inserted replaced
504:dbdf4b8193a8 505:7bc63886d4f2
1 local Io = require "luan:Io" 1 local Io = require "luan:Io"
2 local Http = require "luan:http/Http" 2 local Http = require "luan:http/Http"
3 3
4 local M = {}
5 4
6 local function form() 5 local function form()
7 %> 6 %>
8 <html> 7 <html>
9 <body> 8 <body>
27 </body> 26 </body>
28 </html> 27 </html>
29 <% 28 <%
30 end 29 end
31 30
32 function M.respond() 31 return function()
33 Io.stdout = Http.response.text_writer() 32 Io.stdout = Http.response.text_writer()
34 local name = Http.request.parameter.name 33 local name = Http.request.parameter.name
35 if name == nil then 34 if name == nil then
36 form() 35 form()
37 else 36 else
38 hello(name) 37 hello(name)
39 end 38 end
40 end 39 end
41
42 return M