-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}; | ||
} |