Skip to content

fix(hlua): impl LuaRead for Vec<_> & HashMap<_, _> and restrict LuaRead for Strings

Alexey Protsenko requested to merge feature/lua-read-for-vec-and-hashmap into master
  • add a generic LuaRead implementation for Vec<_> and HashMap<_, _>
  • remove implicit conversion from number to string when reading values from stack

Note: this means implementing LuaRead for HashMap<String, _> which can result in extracting numeric keys as strings. Previously this would have resulted in calls to lua_tolstring, which modifies the value on the stack (converts the number to string). But this is not allowed when iterating over tables (which is what happens in LuaRead for HashMap).

So starting from here String::lua_read_to_string will only work if the value on the stack is an actual string, no implicit conversions will be done.

Edited by Alexey Protsenko

Merge request reports