lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Greetings mailing list,

first of all, I'd like to point out that this has already been discussed
(with limited success) on
[stackoverflow](https://stackoverflow.com/questions/57325179/).

Considering all the available information it seems that:

- Whenever an error happens in Lua, some unknown function X is called
internally
- This function X does not appear on the function whitelist, thus
causing another error
- The new error shadows the previous error message, making sandboxed
code near impossible to debug

As OP pointed out in another reply,
the purpose of this exercise seems to be getting a better understanding
of the Lua language,
not to satisfy any real world use-case.

I personally also find this problem very interesting.

Trying to call `error 'foobar'` with the hook set the error changes only
slightly:

"calling bad function ([C]:-1): ?"

Some logical conclusions:

- `error` seems to be written in C; as such we won't be able to just
peek into its upvalues
- X is most likely not a plain C function, but a C closure within the
Lua state, since the hook is called
- X has no meaningful name here because it's called from a C function