tomaka / hlua

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

AnyLuaValue reads numeric strings as strings (fix #170) #171

Closed tpdickso closed 7 years ago

tpdickso commented 7 years ago

This is a breaking change, as it was previously the case that parsing a numeric string such as "-2" would return a AnyLuaValue::LuaNumber. It's up to the maintainer whether this is desired.

The code is ugly-branchy, since the two branches don't have the same type (the repeated parsing builds up &s on the lua variable.)

tpdickso commented 7 years ago

I can do the same for AnyHashableLuaValue, if wanted. It might be inconsistent to have one perform coercion and the other not.

Alternatively, there could be a third type, AnyExactLuaValue or something along those lines...

tomaka commented 7 years ago

It's definitely something desirable to have the AnyLuaValue that actually matches the exact type of the variable. Since it's more or less a bugfix, I guess I'll just merge that despite the breaking change. Thanks!