tomaka / hlua

Rust library to interface with Lua
MIT License
507 stars 48 forks source link

Report better conversion errors to the Rust side #174

Open linkmauve opened 6 years ago

linkmauve commented 6 years ago

Here is a typical mistake I’ve encountered:

lua.execute::<String>("return '\\xc0'")

The Lua string returned isn’t valid UTF-8, yet the execute call tries to convert it into a String, and fails. The only hint I have to figure out what happened is Err(WrongType), it would be nice to put in this error exactly why that happened, bonus points for including a representation of the original string.