diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-06-18 16:52:22 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-06-18 16:52:22 -0300 |
| commit | be73f72fcc944a8ebae2c60d2ce84139acb011b9 (patch) | |
| tree | 6ba1154c224a4b7af9e5202b4b52e43706faddb1 /ldblib.c | |
| parent | 3cd9b56ae6002b4ef28d2467abd119606ae625d3 (diff) | |
| download | lua-be73f72fcc944a8ebae2c60d2ce84139acb011b9.tar.gz lua-be73f72fcc944a8ebae2c60d2ce84139acb011b9.tar.bz2 lua-be73f72fcc944a8ebae2c60d2ce84139acb011b9.zip | |
New function 'setCstacklimit'
Added new functions to dynamically set the C-stack limit
('lua_setCstacklimit' in the C-API, 'debug.setCstacklimit' in Lua).
Diffstat (limited to 'ldblib.c')
| -rw-r--r-- | ldblib.c | 12 |
1 files changed, 12 insertions, 0 deletions
| @@ -437,6 +437,17 @@ static int db_traceback (lua_State *L) { | |||
| 437 | } | 437 | } |
| 438 | 438 | ||
| 439 | 439 | ||
| 440 | static int db_setCstacklimit (lua_State *L) { | ||
| 441 | int limit = (int)luaL_checkinteger(L, 1); | ||
| 442 | int res = lua_setCstacklimit(L, limit); | ||
| 443 | if (res == 0) | ||
| 444 | lua_pushboolean(L, 0); | ||
| 445 | else | ||
| 446 | lua_pushinteger(L, res); | ||
| 447 | return 1; | ||
| 448 | } | ||
| 449 | |||
| 450 | |||
| 440 | static const luaL_Reg dblib[] = { | 451 | static const luaL_Reg dblib[] = { |
| 441 | {"debug", db_debug}, | 452 | {"debug", db_debug}, |
| 442 | {"getuservalue", db_getuservalue}, | 453 | {"getuservalue", db_getuservalue}, |
| @@ -454,6 +465,7 @@ static const luaL_Reg dblib[] = { | |||
| 454 | {"setmetatable", db_setmetatable}, | 465 | {"setmetatable", db_setmetatable}, |
| 455 | {"setupvalue", db_setupvalue}, | 466 | {"setupvalue", db_setupvalue}, |
| 456 | {"traceback", db_traceback}, | 467 | {"traceback", db_traceback}, |
| 468 | {"setCstacklimit", db_setCstacklimit}, | ||
| 457 | {NULL, NULL} | 469 | {NULL, NULL} |
| 458 | }; | 470 | }; |
| 459 | 471 | ||
