Fix lua integer -> enum conversion for command params

This commit is contained in:
David Capello 2019-01-09 20:41:41 -03:00
parent 2c58169cbb
commit e9e28dce19

View File

@ -91,7 +91,7 @@ void Param<std::string>::fromLua(lua_State* L, int index)
template<>
void Param<app::SpriteSheetType>::fromLua(lua_State* L, int index)
{
if (lua_isstring(L, index))
if (lua_type(L, index) == LUA_TSTRING)
fromString(lua_tostring(L, index));
else
setValue((app::SpriteSheetType)lua_tointeger(L, index));
@ -100,7 +100,7 @@ void Param<app::SpriteSheetType>::fromLua(lua_State* L, int index)
template<>
void Param<app::DocExporter::DataFormat>::fromLua(lua_State* L, int index)
{
if (lua_isstring(L, index))
if (lua_type(L, index) == LUA_TSTRING)
fromString(lua_tostring(L, index));
else
setValue((app::DocExporter::DataFormat)lua_tointeger(L, index));