It is absolutely possible, that is what the OpenResty stands for.
It's amazing that this exists, I would have never thought it possible (because of what I saw as inherent limits in what can be expressed in terms of nginx configuration), but now that I see it, of course it is :). From what I gather, custom code can be written as Lua scripts, and many of the modules are written in Lua themselves.
Thank you for sharing this!
Are you building a project (or projects) on OpenResty?