From bd1afc184acd40820a55be33266c32fd820c9ece Mon Sep 17 00:00:00 2001 From: rxi Date: Sat, 14 Jun 2014 16:27:42 +0100 Subject: [PATCH] Added onLuaPanic() function to main.c --- src/main.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main.c b/src/main.c index bb1fd41..7e4ccde 100644 --- a/src/main.c +++ b/src/main.c @@ -28,6 +28,13 @@ static void deinit(void) { dmt_dump(stdout); } +static int onLuaPanic(lua_State *L) { + vga_deinit(); + const char *err = lua_tostring(L, -1); + printf("lua panic: %s\n", err); + return 0; +} + int luaopen_love(lua_State *L); @@ -40,6 +47,7 @@ int main(void) { /* Init lua */ L = luaL_newstate(); + lua_atpanic(L, onLuaPanic); luaL_openlibs(L); luaL_requiref(L, "love", luaopen_love, 1);