Skip to content

Commit

Permalink
增加bee.crash
Browse files Browse the repository at this point in the history
  • Loading branch information
actboy168 committed Jul 10, 2024
1 parent c02621e commit 4f7dfb4
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions binding/lua_crash.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include <bee/lua/module.h>
#include <bee/lua/udata.h>
#include <bee/crash/handler.h>

namespace bee::lua_crash {
static int create_handler(lua_State* L) {
const char* dump_path = luaL_checkstring(L, 1);
lua::newudata<bee::crash::handler>(L, dump_path);
return 1;
}

static void metatable(lua_State* L) {
}

static int luaopen(lua_State* L) {
static luaL_Reg lib[] = {
{ "create_handler", create_handler },
{ NULL, NULL },
};
luaL_newlibtable(L, lib);
luaL_setfuncs(L, lib, 0);
return 1;
}
}

DEFINE_LUAOPEN(crash)

namespace bee::lua {
template <>
struct udata<bee::crash::handler> {
static inline auto metatable = bee::lua_crash::metatable;
};
}

0 comments on commit 4f7dfb4

Please sign in to comment.