Auto delete MetaData when = 0 (#8770)

* Auto delete MetaData when = 0
This commit is contained in:
Lejo 2020-05-02 12:57:04 +02:00 committed by GitHub
parent 61d93988d8
commit 808eb4c571
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -153,7 +153,9 @@ int MetaDataRef::l_set_int(lua_State *L)
MetaDataRef *ref = checkobject(L, 1);
std::string name = luaL_checkstring(L, 2);
int a = luaL_checkint(L, 3);
std::string str = itos(a);
std::string str;
if (a != 0)
str = itos(a);
Metadata *meta = ref->getmeta(true);
if (meta == NULL || str == meta->getString(name))
@ -191,7 +193,9 @@ int MetaDataRef::l_set_float(lua_State *L)
MetaDataRef *ref = checkobject(L, 1);
std::string name = luaL_checkstring(L, 2);
float a = readParam<float>(L, 3);
std::string str = ftos(a);
std::string str;
if (a != 0)
str = ftos(a);
Metadata *meta = ref->getmeta(true);
if (meta == NULL || str == meta->getString(name))