Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support passing Results to Lua #3

Closed
jonas-schievink opened this issue Jun 13, 2017 · 0 comments
Closed

Support passing Results to Lua #3

jonas-schievink opened this issue Jun 13, 2017 · 0 comments

Comments

@jonas-schievink
Copy link
Contributor

We already have a ToLua impl for Option, which will push the contained value if it exists, and nil otherwise. This maps pretty well into Lua's world.

Another common Lua pattern occurs when dealing with fallible operations like io.open, which either returns the opened file on success, or nil followed by an error message on failure. It would be nice if I could map Rust's Result to this idiom. This would require a ToLuaMulti impl instead of a ToLua impl, though (since the operation can push nil and the error message).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant