diff --git a/ZYX-html-framework/page1.html b/ZYX-html-framework/page1.html index 44992a8..1cf19de 100644 --- a/ZYX-html-framework/page1.html +++ b/ZYX-html-framework/page1.html @@ -15,7 +15,8 @@ La température est: <% -zout(ztemp.."oC") +ztemp=ztemp+1 +zout(ztemp.."°C") %>
Mais il fait encore trop froid !
diff --git a/ZYX-html-framework/web_srv2.lua b/ZYX-html-framework/web_srv2.lua index 926ea57..0b1a7e3 100644 --- a/ZYX-html-framework/web_srv2.lua +++ b/ZYX-html-framework/web_srv2.lua @@ -1,9 +1,16 @@ -- petit script de serveur WEB avec Active Server Page ZYX -print("\n web_srv2.lua zf190127.1127 \n") +print("\n web_srv2.lua zf190127.1340 \n") + +ztemp=12 -- send a file from memory to the client; max. line length = 1024 bytes! function send_file(zclient, zfilename) + zzclient=zclient + function zout(zstring) + zzclient:send(zstring) + end + if zfilename == "" then zfilename = "index.html" end if file.open(zfilename, "r") then repeat @@ -11,14 +18,18 @@ function send_file(zclient, zfilename) if line then if string.find(line, "<%%") then print("start lua...") - lua_code = true + flag_lua_code = true + lua_code = "" elseif string.find(line, "%%>") then print("stop lua...") - lua_code = false - elseif lua_code then - print(line) + flag_lua_code = false + print("Et voici le code lua inline:\n"..lua_code) + loadstring(lua_code)() --on exécute ici le code lua inline ! + elseif flag_lua_code then +-- print(line) + lua_code =lua_code..line else - zclient:send(line) + zout(line) end end until not line