From e5d9c33b09cef50f1568d461513d53c20cd1eb17 Mon Sep 17 00:00:00 2001
From: "p.kosyh"
Date: Wed, 22 Sep 2010 06:48:40 +0000
Subject: [PATCH] debug fix
---
src/sdl-instead/instead.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/sdl-instead/instead.c b/src/sdl-instead/instead.c
index 427014a..33022a9 100644
--- a/src/sdl-instead/instead.c
+++ b/src/sdl-instead/instead.c
@@ -229,7 +229,14 @@ int instead_function(char *s, struct instead_args *args)
n ++;
}
}
+ if (debug_sw) {
+ base = lua_gettop(L) - (method + n); /* function index */
+ lua_pushcfunction(L, traceback); /* push traceback function */
+ lua_insert(L, base); /* put it under chunk and args */
+ }
status = lua_pcall(L, method + n, LUA_MULTRET, base);
+ if (debug_sw)
+ lua_remove(L, base); /* remove traceback function */
if (status) {
fprintf(stderr, "Error calling:%s\n", s);
lua_gc(L, LUA_GCCOLLECT, 0);