jcmoyer / rust-lua53

Lua 5.3 bindings for Rust
MIT License
158 stars 45 forks source link

Difference between State::to_str and State::to_str_in_place #94

Closed jack-fortanix closed 5 years ago

jack-fortanix commented 5 years ago

The function bodies for State::to_str and State::to_str_in_place appear to be identical, as is their doc comment. I was just wondering what is the reason for having both.

https://github.com/jcmoyer/rust-lua53/blob/master/src/wrapper/state.rs#L1308

SpaceManiac commented 5 years ago

One uses luaL_tolstring, the other uses lua_tolstring. These have different behavior, described in the Lua manual.

jack-fortanix commented 5 years ago

Thank you I must have missed this when comparing the functions.