From be73f72fcc944a8ebae2c60d2ce84139acb011b9 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 18 Jun 2019 16:52:22 -0300 Subject: New function 'setCstacklimit' Added new functions to dynamically set the C-stack limit ('lua_setCstacklimit' in the C-API, 'debug.setCstacklimit' in Lua). --- ldblib.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'ldblib.c') diff --git a/ldblib.c b/ldblib.c index d045a82e..513a13cb 100644 --- a/ldblib.c +++ b/ldblib.c @@ -437,6 +437,17 @@ static int db_traceback (lua_State *L) { } +static int db_setCstacklimit (lua_State *L) { + int limit = (int)luaL_checkinteger(L, 1); + int res = lua_setCstacklimit(L, limit); + if (res == 0) + lua_pushboolean(L, 0); + else + lua_pushinteger(L, res); + return 1; +} + + static const luaL_Reg dblib[] = { {"debug", db_debug}, {"getuservalue", db_getuservalue}, @@ -454,6 +465,7 @@ static const luaL_Reg dblib[] = { {"setmetatable", db_setmetatable}, {"setupvalue", db_setupvalue}, {"traceback", db_traceback}, + {"setCstacklimit", db_setCstacklimit}, {NULL, NULL} }; -- cgit v1.2.3-55-g6feb