tomaka / hlua

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

Fix closures that can outlive environment #87

Closed tomaka closed 7 years ago

tomaka commented 7 years ago

Fix #77

I had to add a lifetime parameter to AsLua and AsMutLua.

Unfortunately since the Drop impl of PushGuard requires that the template parameter of PushGuard implements AsMutLua, that means I would have to add a lifetime parameter to the PushGuard struct as well. In order to avoid that, I added a raw_lua member instead. Same for LuaTableIterator.

Eventually this PR could be "reverted" (ie. raw_lua removed) and lifetime parameters of AsLua and AsMutLua could become associated lifetimes.