r/lua • u/NemuiSen • Apr 23 '25
A simple script to generate html code.
I just wanted to share this code to generate html code from lua, i made this because i don't like writing html and for fun to do something in lua. Any sugestions to improve it?
18
Upvotes
2
u/[deleted] May 02 '25
You don't need to generate tags, just use an indexer
4
u/[deleted] Apr 23 '25
fire. i love lua's DSL capabilities. this is the dream scripting language for apps. u can make this thing be anything u want it to be
4
u/thirdtimesthecharm Apr 23 '25 edited Apr 23 '25
This looks like the fmg implementation in Fullmoon (https://github.com/pkulchenko/fullmoon/blob/master/examples/htmxboard/tmpl/index.fmg).
In terms of suggestions, I would look into composition of modals in interesting ways.
edit : further reading : https://leafo.net/guides/dsl-in-lua.html
3
u/bidaowallet Apr 23 '25
Nice work keep up!
3
u/xoner2 Apr 25 '25
I did something similar, for declaring GUI in wxlua:
Now I'm transitioning to different structure where t[1]: function and t[2]..t[#t] are the children:
I've forgotten all the reasons why. IIRC: