Some lua catchup and cleanup

- add nhl_pcall_handle() to wrap all nhl_pcall calls that didn't check
  return value and either panic() or impossible()
- add --loglua (unix only) to dump Lua memory and steps info to livelog
- remove old logging
- set memory and step limits on all Lua VMs
This commit is contained in:
nhkeni
2024-01-04 10:37:38 -05:00
parent 36e8e504c2
commit c7ab9a0565
17 changed files with 181 additions and 102 deletions
+2 -3
View File
@@ -1,4 +1,4 @@
/* NetHack 3.7 nhlua.c $NHDT-Date: 1582675449 2020/02/26 00:04:09 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.20 $ */
/* NetHack 3.7 nhlua.c $NHDT-Date: 1704225560 2024/01/02 19:59:20 $ $NHDT-Branch: keni-luabits2 $:$NHDT-Revision: 1.61 $ */
/* Copyright (c) 2018 by Pasi Kallinen */
/* NetHack may be freely redistributed. See license for details. */
@@ -917,8 +917,7 @@ l_selection_iterate(lua_State *L)
lua_pushvalue(L, 2);
lua_pushinteger(L, tmpx);
lua_pushinteger(L, tmpy);
if (nhl_pcall(L, 2, 0)) {
impossible("Lua error: %s", lua_tostring(L, -1));
if (nhl_pcall_handle(L, 2, 0, "l_selection_iterate", NHLpa_impossible)) {
/* abort the loops to prevent possible error cascade */
goto out;
}