tomaka / hlua

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

LuaArray should be Vec<(AnyHashableLuaValue, AnyLuaValue)> #186

Open kpcyrd opened 6 years ago

kpcyrd commented 6 years ago

I'm having trouble converting from HashMap<AnyHashableLuaValue, AnyLuaValue> to AnyLuaValue::LuaArray due to this. Since the first element is the key, I think AnyHashableLuaValue is the correct way to go here.

Thanks!

tpdickso commented 6 years ago

This wouldn't be correct, as lua tables can have floating-point keys, which are not hashable, so it would be incorrect to disallow AnyLuaValue from representing this. The correct solution, I think, would be to have impl From<AnyHashableLuaValue> for AnyLuaValue.