3 ms·
Absolutely. I built my own DIY thermostat and was spending weeks of free time working on the configuration system for it so that it could do the things I wanted
by connicpu 3y ago
Absolutely. I built my own DIY thermostat and was spending weeks of free time working on the configuration system for it so that it could do the things I wanted. I thought I had a decent system for it, and then I realized it's a pain in the ass to work with in its JSON format. Rather than find a language that would make the configuration model easier to work with or building an entire UI for it, I finally realized it would be way easier to just do it as code, and there was no better choice than Lua.
Add a few helper functions, and the configuration that dynamically changes the target temps throughout the day is a 12 line Lua function that determines what the HVAC system should do based on the current state, current time, and the current temperature.
- shadowgovt 3y agoThe biggest criticism I've heard is "I don't want my config language to be Turing-complete." I agree; nobody does. But two of the three config languages I used started out as static no-frills languages and eventually became Turing-complete by accretion of need to support more and more complicated configurations, and given that they were headed there eventually, I wish they'd been Lua instead of a Turing-complete bespoke language with its own parser, its own (bad) error messages, little thought paid to debugging ("hey, it was never supposed to be complicated enough to need debugging!"), and no tooling.
- corysama 3y agoThat’s exactly where Lua came from. They had a comfort language that was heading towards Turing complete. So, they took it there intentionally rather than accidentally.