-
-
Notifications
You must be signed in to change notification settings - Fork 184
Open
Description
A Lua error can contain any Lua value, bubbling up the stack to the nearest native function (or pcall
). The following Lua code for instance uses an error to call a function and actually prints `"Hello, World".
local function thing()
print("Hello, World")
end
local function fallible()
error(thing)
end
local err, result = pcall(fallible)
result()
This can be useful in situations where an error is intended to carry data or otherwise have some meaning to the code receiving it. It seems like, however, mlua eagerly formats all RuntimeErrors upon receiving them, erasing any actual values carried with them. Looking at the source code I see no immediate reason for this. Is this simply a limitation of mlua?
This appears to be the offending line, I do apologize if I've missed some reason this is nessecary.
Line 123 in 85b280a
let err_string = to_string(state, -1); |
XeroOl and Kanaye
Metadata
Metadata
Assignees
Labels
No labels