From a97f29f15487c5f584185f646f9cfc06a04b26ca Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 29 Aug 2000 17:43:28 -0300 Subject: explicit stack control in the API --- lauxlib.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lauxlib.c') diff --git a/lauxlib.c b/lauxlib.c index 12d1d067..2c54bd02 100644 --- a/lauxlib.c +++ b/lauxlib.c @@ -1,5 +1,5 @@ /* -** $Id: lauxlib.c,v 1.31 2000/08/28 17:57:04 roberto Exp roberto $ +** $Id: lauxlib.c,v 1.32 2000/08/29 14:33:31 roberto Exp roberto $ ** Auxiliary functions for building Lua libraries ** See Copyright Notice in lua.h */ @@ -49,6 +49,12 @@ static void type_error (lua_State *L, int narg, const char *type_name) { } +void luaL_checkstack (lua_State *L, int space, const char *mes) { + if (space > lua_stackspace(L)) + luaL_verror(L, "stack overflow (%.30s)", mes); +} + + /* ** use the 3rd letter of type names for testing: ** nuMber, niL, stRing, fuNction, usErdata, taBle, anY -- cgit v1.2.3-55-g6feb