The language implementation is fast, and allows you to tap into any C-compatible library.
The question isn't why you would go through Lua, but why you would choose something with less support?
That's the role of the C API [0]. But usually you'd just be passing C up to Lua to bind it together.
C isn't hard to maintain -- it's not some mystical language..
Tools should be ergonomic, they should reduce the need for diligence, care, discipline, and intelligence.
I'm not saying that the above aren't all important to programming, or that we should abandon anything that's not easy, but we're humans and make human mistakes and tools that are unforgiving when we do are ripe to be replaced by those that nudge us back on track.
I completely agree with you on all points. Languages exist to make our lives easier.
When developers demand that compilers compete with each other on fractions of a percent of runtime performance, we set ourselves up for things like UB acting in unintuitive ways. When people give us the choice between safer but slower systems, and fast but unsafe ones, until recently people have overwhelmingly chosen fast and unsafe and pretended they're superhuman enough to not write bad code.
For nginx-c-function, it's easy build and I can build this as dynamic module and use it with other servers which has same version of nginx.
It might be good to use lua if the person not good in c/c++.