Several solutions exist for detection of mobile clients and browsers. The more elaborate (like WURFL) have detailed specs and involve license fees and/or license restrictions.
Our needs are currently simple: we want to serve the "mobile" version of pages to small-display devices like phones, and the full version to everything else (desktops, tablets, crawlers, etc.).
There are open-source solutions for answering the simple questions, such as pymobiledetect (if your Web server is scriptable in Python) and variants. These essentially do regex-matching on a big list of User-Agent strings. Something like this (though not exactly this) is what we've been doing for years.
Is there anything in this vein that's readily available and reasonably up-to-date and that's also suitable for use with Nginx, Lua, and OpenResty? We could port the code from pymobiledetect to Lua but that would be an ongoing maintenance headache since that code base is likely to be updated frequently.