ltheory
ltheory copied to clipboard
Return Result structure from the Rust code to Lua
Idea was suggested by @dgavedissian here.
It is possible now to return Result<T, E> from the impl methods with luajit_ffi attribute. In this case Rust will panic in the case of error.
But it would be better to let Lua script decide what to do in this case, so we can instead of panic return all necessary data to Lua:
struct Result_T_E {
T ok;
E error;
bool is_ok;
};
We have to discuss with the script team format of this structure and in what cases we should return it and in what just panic.