summaryrefslogtreecommitdiff
path: root/lib/lua/src
diff options
context:
space:
mode:
Diffstat (limited to 'lib/lua/src')
-rw-r--r--lib/lua/src/ldo.c9
-rw-r--r--lib/lua/src/lvm.c6
2 files changed, 13 insertions, 2 deletions
diff --git a/lib/lua/src/ldo.c b/lib/lua/src/ldo.c
index 2198c58..44bba83 100644
--- a/lib/lua/src/ldo.c
+++ b/lib/lua/src/ldo.c
@@ -1,5 +1,5 @@
/*
-** $Id: ldo.c,v 1.2 2003-12-11 16:53:30 pixel Exp $
+** $Id: ldo.c,v 1.3 2004-07-23 13:08:23 pixel Exp $
** Stack and Call structure of Lua
** See Copyright Notice in lua.h
*/
@@ -391,6 +391,13 @@ LUA_API int lua_yield (lua_State *L, int nresults) {
return -1;
}
+LUA_API void lua_break (lua_State *L) {
+ CallInfo * ci;
+ lua_lock(L);
+ ci = L->ci;
+ ci->state |= CI_BREAK;
+ lua_unlock(L);
+}
int luaD_pcall (lua_State *L, Pfunc func, void *u,
ptrdiff_t old_top, ptrdiff_t ef) {
diff --git a/lib/lua/src/lvm.c b/lib/lua/src/lvm.c
index bc40f5c..3a8a974 100644
--- a/lib/lua/src/lvm.c
+++ b/lib/lua/src/lvm.c
@@ -1,5 +1,5 @@
/*
-** $Id: lvm.c,v 1.2 2003-12-11 16:53:30 pixel Exp $
+** $Id: lvm.c,v 1.3 2004-07-23 13:08:23 pixel Exp $
** Lua virtual machine
** See Copyright Notice in lua.h
*/
@@ -421,6 +421,10 @@ StkId luaV_execute (lua_State *L) {
L->ci->state = CI_YIELD | CI_SAVEDPC;
return NULL;
}
+ if (L->ci->state & CI_BREAK) { /* did hook break? */
+ luaG_runerror(L, "breaking");
+ L->ci->state &= ~CI_BREAK;
+ }
}
/* warning!! several calls may realloc the stack and invalidate `ra' */
base = L->base;