You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to add error handling to my code, sadly I'm having trouble getting it to work:
If your Rust function returns a Result object which contains an error, then a Lua error will be triggered.
My setup looks like this: rust runtime -> calls into a lua script -> calls into a rust function I'm providing
the error happens inside the rust function that I'm calling. The script looks like this:
function verify(user, password)
return execve("./2docs/test.sh", {user, password}) == 0
end
where ./2docs doesn't exist and causes an Err(_), but the result of .call_with_args is Ok(LuaBoolean(false)). When removing the == 0 I'm getting LuaNil which doesn't seem like an error either.
What I'm trying to do:
either get an error inside the lua script that I can return to the runtime
do something inside the rust function that allows my to abort the script and return the error directly to the runtime
Help would be appreciated!
The text was updated successfully, but these errors were encountered:
I'm trying to add error handling to my code, sadly I'm having trouble getting it to work:
My setup looks like this:
rust runtime -> calls into a lua script -> calls into a rust function I'm providing
the error happens inside the rust function that I'm calling. The script looks like this:
where
./2docs
doesn't exist and causes anErr(_)
, but the result of.call_with_args
isOk(LuaBoolean(false))
. When removing the== 0
I'm gettingLuaNil
which doesn't seem like an error either.What I'm trying to do:
Help would be appreciated!
The text was updated successfully, but these errors were encountered: