This is similar to the LWAN_LUA_METHOD() macro that extends the request metatables, but both have been revamped to be simpler under the hood (to e.g. not require a copy of all the luaL_Reg entries just so a sentinel can be added).
With LSPs, it's now even possible to add some additional Lua code, so one can create a nicer API on top of some primitives written in C.
Now I just need to write some applications to actually design good APIs. I might even depart from CivetWeb's APIs.