Skip to content

Commit

Permalink
Auto delete MetaData when = 0 (#8770)
Browse files Browse the repository at this point in the history
* Auto delete MetaData when = 0
  • Loading branch information
Lejo1 committed May 2, 2020
1 parent 61d9398 commit 808eb4c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/script/lua_api/l_metadata.cpp
Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 808eb4c

Please sign in to comment.