Template
Observatory.
An interactive Lua showcase with forms and a masked demo code. It runs Lua on its host; this page shows its source without running it.
Preview
hub://your-site/LANTERN 0.2
This template builds every page with app.lua.
Source
app.lua
1return function(ctx)2 local P=ctx.page3 local art={'ffffffffffff1111ffffffffffff','fffffffffff14441fffffffffff','ffffffffff1444441ffffffffff','fffffffffff14441fffffffffff','ffffffffff1111111ffffffffff','ffffffffff1fffff1ffffffffff','fffffffff11fffff11fffffffff','ffffffff11111111111ffffffff'}4 local children={P.image{rows=art,text='A lantern in the night'},P.heading{text='THE LANTERN OBSERVATORY'},P.paragraph{text='Small screens. Bright ideas. An interactive field station between worlds.'},P.columns{children={P.section{children={P.heading{text='01 / EXPLORE'},P.paragraph{text='Palette pixel art, headings, lists and links.'}}},P.section{children={P.heading{text='02 / INTERACT'},P.paragraph{text='Forms travel securely to server-side Lua.'}}}}}}5 if ctx.method=='POST' and ctx.path=='/experiment' then6 local code=tostring(ctx.fields.code or '')7 if code~='glow' then8 children[#children+1]=P.heading{text='Try the demo code: glow'}9 children[#children+1]=P.paragraph{text='That code did not match. No password or form content was saved.'}10 else11 local name=tostring(ctx.fields.explorer or 'Traveler'):sub(1,60)12 local biome=tostring(ctx.fields.biome or 'Forest'):sub(1,40)13 children[#children+1]=P.heading{text='Welcome, '..name..'.'}14 children[#children+1]=P.paragraph{text='Your destination: '..biome..'. Your beacon is '..(ctx.fields.beacon and 'lit' or 'off')..'. This response was built by server Lua.'}15 children[#children+1]=P.paragraph{text='The demo code was checked and discarded. No login session was created.'}16 end17 children[#children+1]=P.link{text='Try another experiment',href='/'}18 elseif ctx.method=='GET' and ctx.path=='/' then19 children[#children+1]=P.list{items={'Layouts stack on pocket computers.','Keyboard: Tab selects, Enter activates.','Password fields are masked in the updated browser.'}}20 children[#children+1]=P.heading{text='Run your own experiment'}21 children[#children+1]=P.paragraph{text='Use the public demo code glow. Never enter a real password here. Masking hides typing; it is not account authentication.'}22 children[#children+1]=P.form{action='/experiment',children={P.input{name='explorer',text='Explorer name'},P.select{name='biome',text='Choose a biome',options={'Forest','Desert','Snowy peaks','The End'}},P.checkbox{name='beacon',text='Light the beacon'},P.input{name='code',text='Demo code (glow)',password=true},P.submit{text='Launch experiment'}}}23 else return {kind='error',status=404,message='Page not found'} end24 children[#children+1]=P.link{text='Read the component reference',href='hub://help/components.json'}25 return {kind='page',page=P.document('Lantern Observatory',children)}26endapp.lua answers every request, so each page is built in Lua.