lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Mon, Nov 9, 2015 at 12:04 AM, Ole Krüger <> wrote:
> Hello everybody,
> quite a while ago I chose to release the header-only C++14 wrapper I have
> been using. It focuses on minimal overhead, which reflects greatly in terms
> of performance.
> On GitHub:
> I have been cleaning up some of the internals aswell as the exposed API to
> make things a little easier to use.
> I would love to read some feedback.
> Ole

Hi, Ole

nice work!

1. Please enable Travis CI to run tests automatically.

2. Can you add support of Lua errors vs C++ exceptions conversion?

I use the following wrapper class which converts C++ LuaCfunction
throwing C++ exceptions to LuaCFunction throwing Lua errors:

template<lua_CFunction F>
struct wrap {
    static int func(lua_State* L) {
        try {
            return F(L);
        } catch (std::exception& e) {
            lua_pushstring(L, e.what());
        } catch (...) {
            lua_pushliteral(L, "Unknown exception");
        return lua_error(L);

int foo(lua_State* L) {
    throw std::logical_error("I am foo!");

luaL_Reg module_functions[] = {
    {"foo", wrap<foo>::func},


Best regards,
Boris Nagaev