LuaMacros (from version 0.1.0.220) have embedded simple 1-thread web server. Any request for this server can be handled in Lua code and therefore trigger another action. Typical usage would be for flight simulation when you prepare some nice looking web page with plane's panel and by clicks in this panel you control your plane in simulator. The web page can be opened not only at local computer but also from different computer connected through network, tablet, phone...

Let's see how to do this in code. The simplest web server started at port 12345 would be

There's more. The web page doesn't work well now. And I don't mean it doesn't have very nice background image and links displayed as buttons at light panel. The problem is you click the link and end up at page generated by LuaMacros application which shows just OK. You don't see you nice panel any more. If you are html developer you don't care and convert links to some modern AJAX calls. If you're not you just add "/back" at the beginning of your links. Now LuaMacros recognizes the "/back" at the beginning and use it internally. It means the "/back" won't arrive into your LUA code. You don't need to change the code. What LuaMacros application does is it won't generate just "OK" result page but page which will hit Back button of your browser via JavaScript. So you will end up at your original page with panel. So try this html code:

There's even more. Without the "/back" feature LuaMacros return just boring "OK" as response. But wait, LuaMacros can also read data from the simulator. So maybe with some small web development your panel could even show if your taxi lights or beacon is on or off. Maybe it could display frequency of your radios. So why you don't read frequency of ADF in LuaMacros and don't return it instead of that boring OK? Then you can read the response and adapt you panel accordingly. The LUA code would be for example: