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?
This commit is contained in:
Michael Meyer
2022-08-02 15:06:06 -04:00
committed by Pasi Kallinen
parent 723ee6d1f6
commit 719a85f37c

View File

@@ -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);