tomaka / hlua

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

Store index with UserdataOnStack so that correct value is read in Deref #179

Closed tpdickso closed 7 years ago

tpdickso commented 7 years ago

the Deref and DerefMut impls previously always read from the index -1, which would be incorrect if the userdata were stored elsewhere. This adds an index field to UserdataOnStack which is filled in when it is created in lua_read_at_position, so that the value is always read from the correct position. This allows having userdata in function arguments aside from the first, for example.

tomaka commented 7 years ago

Thanks