From 719a85f37c6dd97135edfd766366c98c389c18be Mon Sep 17 00:00:00 2001 From: Michael Meyer Date: Tue, 2 Aug 2022 15:06:06 -0400 Subject: [PATCH] Allow lua test files to call error() Enable 'debugging' function calls, including error(), from the lua files called by the wizard-mode #wizloadlua command. Without enabling them, calling error() still produces an error but with a message like "attempt to call a nil value (global 'error')" instead of the one specified in the lua file. I think this is the right way to do this without just enabling everything across the board (which I assume would contradict the goals of NHL_SANDBOX), but I will admit to being a little confused by trying to understand exactly how the sandbox permissions work, so it's possible this isn't the right solution. Incidentally, I am probably misunderstanding this, but considering a lua error still occurs when error() is called, just with a different error message, is the function really "disabled" successfully by NHL_SANDBOX? --- src/cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd.c b/src/cmd.c index 67967444b..d5854166a 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1357,7 +1357,7 @@ wiz_load_lua(void) { if (wizard) { char buf[BUFSZ]; - nhl_sandbox_info sbi = {NHL_SB_SAFE, 0, 0, 0}; + nhl_sandbox_info sbi = {NHL_SB_SAFE | NHL_SB_DEBUGGING, 0, 0, 0}; buf[0] = '\0'; getlin("Load which lua file?", buf);